0
votes

I am making a macro for a game I play, in where I can sit watching a terminal.

I hope when I press Alt+P it presses E on the terminal, it scrolls down so screen can show the item mouse needs to click, then clicks given coordinate and waits 20 seconds. (repeat forever until press Alt+O to stop)


!p::
while toggle==0
    (send e)
    Loop 3
        send {WheelDown}
    send {click,1210,670}
    Sleep, 20000
!o:: toggle=(toggle+1)

However it keeps the E key held down indefinitely.

1

1 Answers

0
votes

The reason e appears to be being held is because your while-loop is only executing the "(send e)" line. If you need the while-loop to execute more than one line of code, enclose the code block in brackets. Also, unless your individual hotkeys are one line, you'll want to put a Return at the end each; otherwise, it will continue to execute into the next hotkey's code and so on.

Here is my untested version of your code. Please let me know if this works for you.

!p::
While !toggle
{
    Send , e{WheelDown 3}{click , 1210 , 670}
    Sleep , 20000
}
toggle := !toggle
Return
!o::toggle := !toggle