Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

DeskTopControl - multiple monitor solution


  • Please log in to reply
11 replies to this topic
skrommel
  • Members
  • 193 posts
  • Last active: Jun 07 2010 08:30 AM
  • Joined: 30 Jul 2004
8) 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


; 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


Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
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 [email protected]

skrommel
  • Members
  • 193 posts
  • Last active: Jun 07 2010 08:30 AM
  • Joined: 30 Jul 2004
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

Jimmy2Times
  • Members
  • 65 posts
  • Last active: Jul 15 2014 07:56 PM
  • Joined: 07 Apr 2004
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.

TheLeO
  • Members
  • 264 posts
  • Last active: Jan 02 2012 01:51 AM
  • Joined: 11 Jun 2005
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.
::
I Have Spoken
::

Terrapin
  • Members
  • 107 posts
  • Last active: Feb 06 2007 03:38 PM
  • Joined: 15 Aug 2005
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. :)

skrommel
  • Members
  • 193 posts
  • Last active: Jun 07 2010 08:30 AM
  • Joined: 30 Jul 2004
I've just uploaded another solution using IrFanView.

Posted Image MultiMonMan

Posted Image

You'll find the code and more info at
http://www.donationc...tml#MultiMonMan

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

Skrommel

holomind
  • Members
  • 341 posts
  • Last active: Aug 23 2015 03:27 PM
  • Joined: 11 Mar 2006

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.

Musa
  • Members
  • 25 posts
  • Last active: Nov 11 2010 05:57 PM
  • Joined: 31 Aug 2006
This tool has saved me a lot and I can't live without it, seriously. Thanks to skrommel for sharing this.

Since i moved to Windows 7, I cannot use this any more :(. Has any of us tweaked it and used it in Windows 7? If so, could you please share and save my life and others like me?

Many, many thanks!
Musa.Biralo

TIME
  • Guests
  • Last active:
  • Joined: --

This tool has saved me a lot and I can't live without it, seriously. Thanks to skrommel for sharing this.

Since i moved to Windows 7, I cannot use this any more :(. Has any of us tweaked it and used it in Windows 7? If so, could you please share and save my life and others like me?

Many, many thanks!


Search for this code in the .ahk file.

PAINT:
Loop
{
ptooltip=0
pcount=0
Loop,4
{
pmonitor:=A_Index
IfWinExist,%pmonitor% - %applicationname%
{
pcount+=1
WinGetPos,px,py,pw,ph,%pmonitor% - %applicationname%
pw:=pw-2*borderh
ph:=pw*%pmonitor%Aspect
If (pw<>poldw%pmonitor% Or ph<>poldh%pmonitor%)
WinMove,%pmonitor% - %applicationname%,,,,,% ph+titlebarh+borderh*2
poldw%pmonitor%:=pw
poldh%pmonitor%:=ph
DllCall("gdi32.dll\StretchBlt",UInt,hdc_target_%pmonitor%,Int,0,Int,0,Int,pw,Int,ph
,UInt,hdc_source,UInt,%pmonitor%Left,UInt,%pmonitor%Top,Int,%pmonitor%Width,Int,%pmonitor%Height,UInt,0xCC0020) ; SRCCOPY
MouseGetPos,pmx,pmy
pwx:=px+(pmx-%pmonitor%Left)/%pmonitor%Width*pw+borderh
pwy:=py+(pmy-%pmonitor%Top)/%pmonitor%Height*ph+borderh+titlebarh
If (pwx>=px+borderh And pwx<=px+pw+2*borderh And pwy>=py+borderh+titlebarh And pwy<=py+ph+2*borderh+titlebarh)
{
markx:=pwx-borderh-px
marky:=pwy-borderh-titlebarh-py
DllCall("MoveToEx",UInt,hdc_target_%pmonitor%,Int,markx-4,Int,marky,Str,0)
DllCall("LineTo",UInt,hdc_target_%pmonitor%,Int,markx+5,Int,marky)
DllCall("MoveToEx",UInt,hdc_target_%pmonitor%,Int,markx,Int,marky-4,Str,0)
DllCall("LineTo",UInt,hdc_target_%pmonitor%,Int,markx,Int,marky+5)
ptooltip+=1
tx:=pwx
ty:=pwy
}
Gosub,MOUSE
Sleep,%delay%
}
}
If ptooltip=0
ToolTip
If pcount=0
ExitApp
}


Add the semicolon omission to the code (Add red) ;MouseGetPos,pmx,pmy

You'll lose the in window mouse pointer. However it doesn't crash.

I hope this helps.

greenware
  • Members
  • 1 posts
  • Last active: Oct 27 2011 04:32 PM
  • Joined: 27 Oct 2011
Thanks Time,

It worked and fixed the bug which caused MultiMonMan to crash in windows7.

Now do you have a solution for the problem which causes it to show only upto 4 monitors ?

Thanks,
Roy Tal

Marshall666
  • Members
  • 45 posts
  • Last active: May 16 2013 04:03 PM
  • Joined: 09 Mar 2013

First of all:

Many Thx for this Script.. but its not working with Win7 64Bit!

 

I need Help! ;(

 

Error Message: Invalid Option

Specificially: 0 y0 w336.000000

 

 

Add the semicolon omission to the code (Add red) ;MouseGetPos,pmx,pmy

 

 

^^ still Error Message..

 

------------------------------

 

EDIT: Ok MANY MANY THANKS to NNNIK !!! Now i got it!

(But i need the Mousepointer) ..  ;(