Es geht auch mit HotkeySet:
Spoiler anzeigen
Global $HotKeyArray[4][3]
[/autoit] [autoit][/autoit] [autoit]HotKeySet("{F1}", "ShowActiveHotkeys")
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]$HotKeyArray[0][0] = "{F2}" ; Hotkey
$HotKeyArray[0][1] = "Test2" ; Funktionsname
$HotKeyArray[0][2] = "Unbenannt - Editor" ; Fenstername
$HotKeyArray[1][0] = "{F3}"
$HotKeyArray[1][1] = "Test3"
$HotKeyArray[1][2] = "Fenstername"
$HotKeyArray[2][0] = "{F4}"
$HotKeyArray[2][1] = "Test4"
$HotKeyArray[2][2] = "Fenstername"
$HotKeyArray[3][0] = "{F5}"
$HotKeyArray[3][1] = "Test5"
$HotKeyArray[3][2] = "Fenstername"
While 1
Sleep(100)
Updatehotkeys()
WEnd
Func ShowActiveHotkeys()
For $I = 0 To UBound($HotKeyArray) -1
If WinActive($HotKeyArray[$i][2], "") Then
ConsoleWrite("Aktives Fenster: " &$HotKeyArray[$i][2] & @CRLF & "Aktiver Hotkey: " & $HotKeyArray[$i][0] & @CRLF & "Funktionsname: " & $HotKeyArray[$i][1] & @CRLF)
EndIf
Next
EndFunc
Func Updatehotkeys()
For $I = 0 To UBound($HotKeyArray) -1
If WinActive($HotKeyArray[$i][2], "") Then
HotKeySet($HotKeyArray[$i][0], $HotKeyArray[$i][1])
Else
HotKeySet($HotKeyArray[$i][0])
EndIf
Next
EndFunc
Func Test2()
MsgBox(0, "Test", "Test2")
EndFunc
Func Test3()
MsgBox(0, "Test", "Test3")
EndFunc
Func Test4()
MsgBox(0, "Test", "Test4")
EndFunc
Func Test5()
MsgBox(0, "Test", "Test5")
EndFunc