0
如何激活給定顯示器的最前面的窗口?假設我有兩個監視器,一個是編輯器,另一個是不同的應用程序,比如chrome和slack。我想綁定一個可以激活監視器2中最前面的窗口的鍵,無論是鬆弛的還是鍍鉻的,還是一個用於編輯器的,以便於操作。Autohotkey:激活X顯示器的最前面
如何激活給定顯示器的最前面的窗口?假設我有兩個監視器,一個是編輯器,另一個是不同的應用程序,比如chrome和slack。我想綁定一個可以激活監視器2中最前面的窗口的鍵,無論是鬆弛的還是鍍鉻的,還是一個用於編輯器的,以便於操作。Autohotkey:激活X顯示器的最前面
給定監視器中最前面的窗口是當前活動窗口 或(如果當前活動窗口位於另一個監視器上)此監視器的最後一個活動窗口。
; activate the editor:
F1::
WinActivate, ahk_exe notepad.exe ; replace notepad with the ahk_exe of the editor
return
; activate the last active window in the right monitor:
F2::
WinGetPos, X,,,, A
If (X > 1920) ; replace 1920 with the width of the left monitor
return ; do nothing
; otherwise:
WinGet, id, list
Loop, %id%
{
this_ID := id%A_Index%
WinGet, exStyle, exStyle, ahk_id %this_ID%
If !(exStyle & 0x100)
continue
WinGetTitle, title, ahk_id %this_ID%
If (title = "")
continue
WinGetPos, X,,,, ahk_id %this_ID%
If (X > 1920) ; replace 1920 with the width of the left monitor
{
WinActivate, ahk_id %this_ID%
break
}
}
return