AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DeskTopControl - multiple monitor solution

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
skrommel



Joined: 30 Jul 2004
Posts: 178

PostPosted: Fri May 13, 2005 2:39 am    Post subject: DeskTopControl - multiple monitor solution Reply with quote

Cool Do you have mulitple monitors, a projector or other display devices?
DeskTopControl lets you take contol of all the windows on your desktop.

Shows the icons of the running programs in a little window. Move, maximize, drag and drop files... It's not perfect, but it works.

Anyone know another way of getting a file's path other than through the registry?

Skrommel


Code:
; DeskTopControl
;
; Controls all the windows on all your display devices.
; Move, maximize, show windows info, drag and drop files to any program.

DetectHiddenWindows,Off
SetWindelay,0
guititle=DeskTopControl
iconsize=32
winlist=
command=create

START:
  Gosub,NEWWIN
  GetKeyState,lbutton,LButton,P 
  If lbutton=D
    Gosub,INDEX
  Sleep,100
Goto,START

NEWWIN:
  winlist=
  WinGet,id,List,,,Program Manager
  Loop %id%
  {
    winlist=%winlist%%id%
  }
  If winlist<>%oldwinlist%
  {
    Gosub,CREATEGUI
    command=create
    Gosub,INDEX
    command=update
    oldwinlist=%winlist%
  }
Return

TOPMOST:
WinGet,topmost,ExStyle,ahk_id %window%
Transform,topmost,BitAnd,%topmost%,0x8
If topmost<>0
  topmost=On
Else
  topmost=Off
Return

CREATEGUI:
  SysGet,mon1,Monitor,1
  SySGet,mon2,Monitor,2
  SysGet,mon3,Monitor,3
  SySGet,mon4,Monitor,4
  desktopw:=mon1Right
  If mon2Right>%desktopw%
    desktopw:=mon2Right
  If mon3Right>%desktopw%
    desktopw:=mon3Right
  If mon4Right>%desktopw%
    desktopw:=mon4Right
  desktoph:=mon1Bottom
  If mon2Bottom>%desktoph%
    desktoph:=mon2Bottom
  If mon3Bottom>%desktoph%
    desktoph:=mon3Bottom
  If mon4Bottom>%desktoph%
    desktoph:=mon4Bottom
  If command=create
  {
    SysGet,titlebarh,4
    SysGet,borderh,33
    guiw:=desktopw/10
    guih:=desktoph/10
    SysGet,work,MonitorWorkArea
    guix:=workRight-guiw-borderh
    guiy:=workBottom-guih-borderh-titlebarh+4
  }
  Else
    WinGetPos,guix,guiy,,,%guititle%
  Gui,Destroy
  Gui,+AlwaysOnTop -Resize +ToolWindow
  Gui,Show,x%guix% y%guiy% h%guih% w%guiw% NA,%guititle%
Return

INDEX:
  windowlist=
  WinGet,id,List,,,Program Manager
  Loop,%id%
  {
    StringTrimRight,window,id%A_Index%,0
    WinGetTitle,title,ahk_id %window%
    If title<>%guititle%
    If title<>
    {
      iconid=icon%A_Index%
      Gosub,GETPOS
      Gosub,READICON
      If command=create
        Gosub,ADDICON
      Gosub,DRAWICON
      Gosub,MOVEICON
      Gosub,SETINFO
    }
  }
Return

GETPOS:
  WinGetPos,winx,winy,winw,winh,ahk_id %window%
  x:=winx/10
  y:=winy/10
  w:=winw
  h:=winh
  if x<0
    x:=0
  snap:=guiw-iconsize
  if x>%snap%
    x:=snap
  if Y<0
    y:=0
  snap:=guih-iconsize
  if y>%snap%
    y:=snap
Return

SETINFO:
  %iconid%window:=window
  %iconid%info  :=info
  %iconid%file  :=file
  %iconid%path  :=path
  %iconid%title :=title
  %iconid%x     :=x
  %iconid%y     :=y
  %iconid%w     :=w
  %iconid%h     :=h
Return

GETINFO:
  window:=%iconid%window
  info  :=%iconid%info
  file  :=%iconid%file
  path  :=%iconid%path
  title :=%iconid%title
  x     :=%iconid%x
  y     :=%iconid%y
  w     :=%iconid%w
  h     :=%iconid%h
Return

ADDICON:
  Gui,Add,Pic,v%iconid% gMOVE
Return

DRAWICON:
  GuiControl,,%iconid%,*w%iconsize% *h-1 %path%
Return

MoVEICON:
  GuiControl,Move,%iconid%,x%x% y%y%
Return

READICON:
  WinGet,file,ProcessName,ahk_id %window%
  Loop,HKEY_CURRENT_USER,Software\Microsoft\Windows\ShellNoRoam\MUICache,0,0
  {
    IfInString,A_LoopRegName,%file%
    {
      RegRead,info
      path=%A_LoopRegName%
      Break
    }
  }
Return

MOVE:
  iconid:=A_GuiControl
  Gosub,GETINFO
  Gosub,TOPMOST
  If A_GuiControlEvent=DoubleClick
  {
    WinGet,max,MinMax,ahk_id %window%
    If max=0
      WinMaximize,ahk_id %window%
    Else 
      WinRestore,ahk_id %window%
    Gosub,GETPOS
    Gosub,MOVEICON
    Return
  }
  WinSet,AlwaysOnTop,On,ahk_id %window%
  WinSet,AlwaysOnTop,On,%guititle%
  MouseGetPos,mx0,my0       
  GuiControlGet,iconpos,Pos,%iconid%
  offx:=mx0-iconposx
  offy:=my0-iconposy
  moved=0

MOVING:
  MouseGetPos,mx,my
  If moved=0
  {
    If mx<>%mx0%
      moved=1
    If my<>%my0%
      moved=1
  }
  If moved=1
  {
    x:=mx-offx
    y:=my-offy
    Gosub,MOVEICON
    winx:=x*10
    winy:=y*10
    WinMove,ahk_id %window%,,%winx%,%winy%
  }
  ToolTip,%info% - %path% - %title% - x%winx%:y%winy% - t:%topmost%
  GetKeyState,lbutton,LButton,P 
  If lbutton=U
  {
    WinSet,AlwaysOnTop,%topmost%,ahk_id %window%
    WinActivate,ahk_id %window%
    If moved<>0
    {
      Gosub,GETPOS
      Gosub,MOVEICON
      Gosub,SETINFO
    }
    ToolTip
    Return
  }
Goto,MOVING

GUICLOSE:
ExitApp

GUIDROPFILES:
Loop,parse,A_GuiControlEvent,`n
{
  Run,%path% %A_LoopField%
  ToolTip,%path% %A_LoopField%
  Sleep,1000
}
ToolTip
Return
Back to top
View user's profile Send private message Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Fri May 13, 2005 11:13 pm    Post subject: Reply with quote

That sounds like it does a lot. Thanks for sharing it.

By the way, I haven't forgotten about that cool mouse scrolling script you posted about a year ago. One of these days I'm going to put it in the showcase. If you have any newer version of it, feel free to e-mail it to support@autohotkey.com
Back to top
View user's profile Send private message Send e-mail
skrommel



Joined: 30 Jul 2004
Posts: 178

PostPosted: Sat May 14, 2005 8:30 am    Post subject: MouseTailor Reply with quote

What I originally wanted to with my mouse script was to control the thumb tracker(?) of the scroll bar, but I couldn't find the messages to send. And of course make the button combinations user defined. I'll look into it.

Skrommel
Back to top
View user's profile Send private message Visit poster's website
Payam



Joined: 07 Apr 2004
Posts: 58

PostPosted: Wed May 18, 2005 2:51 am    Post subject: Reply with quote

Amazing,just amazing. Talk about thinking "outside the box".

This script really shows the versatility of AHK in my opinion. Thanks Skrommel for the inspiration.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
TheLeO



Joined: 11 Jun 2005
Posts: 160
Location: England ish

PostPosted: Fri Jan 20, 2006 10:42 pm    Post subject: Reply with quote

WOW!!!!!!!!!!!!!!!!!1 That is seriously AMAZING. as in. WOW.
You are a Star



If you could do more amazing scripts for multi monitors it would be just Great.
_________________
And i say: where there is a problem , there is a solution.(well some where that is.)
::
I Have Spoken
::
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Terrapin



Joined: 15 Aug 2005
Posts: 107
Location: North Carolina

PostPosted: Sat Jan 21, 2006 9:31 am    Post subject: Reply with quote

That is really cool, never seen anything like it before. I agree with the previous post, I'd like to see more help for managing multiple monitors. But as it is, it is very, very nice. Innovative.

Bob
_________________
When it comes to Binary, there are 10 types of people. Those who get it and those who don't. Smile
Back to top
View user's profile Send private message
skrommel



Joined: 30 Jul 2004
Posts: 178

PostPosted: Mon Feb 20, 2006 9:38 pm    Post subject: New version Reply with quote

I've just uploaded another solution using IrFanView.

MultiMonMan



You'll find the code and more info at
http://www.donationcoder.com/Software/Skrommel/index.html#MultiMonMan

But it's a bit slow, and it flickers. Anyone got any improvements?

Skrommel
Back to top
View user's profile Send private message Visit poster's website
holomind



Joined: 11 Mar 2006
Posts: 300
Location: Munich, Germany

PostPosted: Sun Mar 12, 2006 3:59 am    Post subject: Re: New version Reply with quote

skrommel wrote:

But it's a bit slow, and it flickers. Anyone got any improvements?


Hi Skrommel, this script is great, i used it as a base to build my DeskMan script which does not show multiple monitors but all open windows and simulates a kind of apple-dock with minimized windows (minimize to dock).

search for "Deskman" in the forum. i also changed the usage of the capture so i only get the targetsize directly also with antialize which shows more details compared to a simple resize.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group