AHK 中的#MaxHotkeysPerInterval 错误。如果陈述错误?

#MaxHotkeysPerInterval error in AHK. If statement wrong?

我想要我的卷。 Up/Down 有多个 'profiles',具体取决于名为 'startVar' 的变量。 但是我写的代码不行。

Volume_Down::
    if(startVar == 0 ){
        SendInput {Volume_Up}
        ;SoundSet -5
        return
    }
    else if (startVar == 1 ){
        Send {Left}
    return
    }
return

Volume_Up::
    if(startVar == 0 ){
        SendInput {Volume_Down}
        ;SoundSet +5
        ;Sleep 30
        return
    }
    else if (startVar == 1 ){
        Send {Right}
    return
    }
return

我希望 Vol.-Up/Down 键可以像 Left/Right 或像往常一样工作。 但是当我想让它们像 Vol.-Up/Down 那样时,我得到了这个错误: Error 我评论了 SoundSet 函数,尽管它起作用了,因为我想要 Windows-Volume-GUI

您收到此邮件是因为 keyboard hook isn't used in your script to implement those hotkeys, which causes the Send command to trigger them over 70 times in a 2 second interval (default values for #MaxHotkeysPerInterval and #HotkeyInterval 如果您未在脚本中指定它们)。

要避免此问题,请指定 #UseHook somewhere above the definition of the hotkeys or prefix them with the dollar symbol $