0
votes

I created a code that should send the "E" key until i press the "T" key. Right now the loop only stops when I hold the "T" key. Could someone help me with this.

F12::
    loop
    {
    Send e
    Sleep 3500
    if (GetKeyState("t")) {
    break
    }
    }
return
1

1 Answers

0
votes

I would suggest to use the following code:

   F12::
        Loop    {
            Send, e
            Sleep 3500
            if break
                break
            }
        return
    
    T::
        break := !break
    return

The above script will stop in a interval between 0 and 3500ms after you press the "T" because you have a "Sleep 3500" in each evaluation.

Your script only stop when you HOLD the "T", because the "T" MUST be pressed while the loop IS ON the GETKEYSTATE function.

P.S: My english is a work in progress..