autohotkeyglobal-hotkey

71 hotkeys have been received in the last X ms


I have a script that assign F1 for a global task:

f1::Run D:\Download

A program needs to use that key, so I put this:

#IfWinActive, ahk_exe inkscape.exe
F1::send {f1}
return

However when I press it, this error hits:

If yes, nothing happens. If no, the script exits.

Do you know what happens?


Solution

  • The problem is that your hotkey keeps triggering itself over and over a again in a loop. The $ modifier will fix it. That way the hotkey wont get triggered when the source of the key press is a Send command.

    However, you don't actually need this at all.
    You should use the #IfWinNotActive directive.

    #IfWinNotActive, ahk_exe inkscape.exe
    F1::Run, D:\Download
    #IfWinNotActive
    

    Alternatively, you could just not create a context sensitive hotkey, and use the ~ modifier. That way the hotkey will always retain its normal functionality when you press it.
    ~F1::Run, D:\Download