I often want to switch the screens programs are shown on. For example, I have Chrome on monitor 1 and Excel on monitor 2. Now, I would like to swap this so that Chrome is on monitor 2 and Excel is on monitor 1. How could I do this? I found this thread that might be useful but I do not know how I could adjust the script: https://www.autohotkey.com/boards/viewtopic.php?t=6035
Here you find the two code samples from the thread:
Code 1:
Code: Select all
#Persistent
SysGet, Mon1, MonitorWorkArea, 1
SysGet, Mon2, MonitorWorkArea, 2
SetTimer, MoveBrowsers, 60000
return
MoveBrowsers:
WinMove, ahk_exe chrome.exe,,Mon1Left, Mon1Top, Mon1Right - Mon1Left, Mon1Bottom - Mon1Top
WinMove, ahk_exe firefox.exe,,Mon2Left, Mon2Top, Mon2Right - Mon2Left, Mon2Bottom - Mon2Top
return
Code: Select all
OnMessage(0x7E, "OnDisplayChange")
OnDisplayChange() {
; Replace the content of this function with whatever.
SysGet mc, MonitorCount
Loop % mc {
SysGet m, Monitor, %A_Index%
s = %s%`nx %mLeft%:%mRight% y %mTop%:%mBottom%
}
MsgBox Displays changed to:%s%
}