是否可以使用AutoHotKey創建與狀態相關的熱鍵?我知道在使用#IfWinActive時,可以在依賴狀態下創建某些熱鍵,但如何在熱鍵內部創建熱鍵?AutoHotKey - 創建與狀態相關的熱鍵
例
F1::
Gui, Show, center center h500 w500, Just a window
return
F2::
MsgBox, 0, F2, You have pressed F2 inside the F1 hotkey
return
return
這裏的問題是,F2不依賴於狀態,並會盡快爲您按下觸發。
可能的解決方法
F1::
state := true
Gui, Show, center center h500 w500, Just a window
return
#If (state = true)
{
F2::
MsgBox, 0, F2, You have pressed F2 inside the F1 hotkey
return
}
GUIclose:
Gui, destroy
state := false
return
return
這是一個可能的解決方案和工作得很好。但是,有沒有比這樣做更簡單的解決方案?
據我知道的,當你已經排除了,有沒有更好的辦法。我會說你幾乎已經釘上了它,代碼看起來很乾淨。做得好。 – errorseven