AutoHotKey keystroke break loop

autohotkey, break, loops

Solution

Use a global variable (keepCycling) and toggle it to break the loop. Global variables should be declared in the beginning of a script.

Problem

Using AutoHotKey, I have a rather simple loop script that I want to be able to break by the stroke of a key. I tried a few different codes from websites but it doesn't seem to work. Here's the code: ``` #g:: Loop 20 { MouseClick, left, 142, 542 Sleep, 1000 MouseClick, left, 138, 567 Sleep, 1500 MouseClick, left, 97, 538 Sleep, 1000 } ```

Original source