Autohotkey 自动热键:激活X监视器的最前端
如何激活给定监视器中最前面的窗口?假设我有两个显示器,一个带有编辑器,另一个带有不同的应用程序,比如chrome和slack。我想绑定一个键来激活监视器中最前面的窗口,两个是slack或chrome,另一个是编辑器,以便于操作。给定监视器中最前面的窗口是当前活动的窗口 或者(如果当前活动窗口位于其他监视器上)此监视器的最后一个活动窗口Autohotkey 自动热键:激活X监视器的最前端,autohotkey,Autohotkey,如何激活给定监视器中最前面的窗口?假设我有两个显示器,一个带有编辑器,另一个带有不同的应用程序,比如chrome和slack。我想绑定一个键来激活监视器中最前面的窗口,两个是slack或chrome,另一个是编辑器,以便于操作。给定监视器中最前面的窗口是当前活动的窗口 或者(如果当前活动窗口位于其他监视器上)此监视器的最后一个活动窗口 ; activate the editor: F1:: WinActivate, ahk_exe notepad.exe ; replace notepad
; 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