It's been working perfectly until I transferred the code over to my new pc running windows 11 pro with a new version of ahk, it no longer seems to bind the window to a key.
Does anyone know what's caused it to fail? All my other scripts seem to be unaffected by the upgrade.
Thanks in advance.
Code: Select all
; Bindable ALT+Fn Window selector - josephusm
; Use Ctrl+Fn to bind the active window, and Alt+Fn to raise it later
Loop, 12
{
id%A_Index% := 0
}
return
RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return
BindKey(key)
{
; Store the active window's ID
WinGet, active_id, ID, A
id%key% := active_id
ToolTip, %key%
SetTimer, RemoveToolTip, 1000
return
}
UseBind(key)
{
; Use the stored window's ID to focus it
; if it still exists
win_id := id%key%
if WinExist("ahk_id" . win_id)
{
WinActivate, ahk_id %win_id%
ToolTip, %key%
SetTimer, RemoveToolTip, 500
}
else
{
ToolTip, %key%: No existing window bound
SetTimer, RemoveToolTip, 1000
}
return
}
^F1::
BindKey(1)
return
!F1::
UseBind(1)
return
^F2::
BindKey(2)
return
!F2::
UseBind(2)
return
^F3::
BindKey(3)
return
!F3::
UseBind(3)
return
^F4::
BindKey(4)
return
!F4::
UseBind(4)
return
^F5::
BindKey(5)
return
!F5::
UseBind(5)
return
^F6::
BindKey(6)
return
!F6::
UseBind(6)
return
^F7::
BindKey(7)
return
!F7::
UseBind(7)
return
^F8::
BindKey(8)
return
!F8::
UseBind(8)
return