autohotkey

Commands don't work even if I add sleep and return in AHK


When I‘m making a script, I can‘t make two functions happen.

Note: I‘m using AutoHotKey‘s 1.137 version.

Code:

<+<!`::Sound beep 627,92   
       Sleep, 100    
       Sound beep 837,92    
       return

Only the Sound beep at pitch 627 is happening, not the other. I try other's suggestions by copy-pasting them, and they work, but my handwritten script doesn‘t work.

Did I make any mistake? Thanks.


Solution

  • To have more than one command executed by a hotkey, put the first line beneath the hotkey definition and make the last line a return:

    <+<!`::
        SoundBeep 627,92   
        Sleep, 100    
        SoundBeep 837,92    
    return
    

    For more details, read the Hotkey page.