Code: Select all
xButton2::
Send, 4
Sleep, 100
Send, 2
Sleep, 50
Click, Left, 1
Sleep, 100
Send, 8
Sleep, 2000
Send, 4
Return
Code: Select all
xButton2::
Send, 4
Sleep, 100
Send, 2
Sleep, 50
Click, Left, 1
Sleep, 100
Send, 8
Sleep, 2000
Send, 4
Return
from https://www.autohotkey.com/docs/misc/Threads.htmBy default, a given hotkey or hotstring subroutine cannot be run a second time if it is already running. Use #MaxThreadsPerHotkey to change this behavior.
That won't get it to start over immediately if he presses the hotkey in the middle of the subroutine executing.Lowy wrote: ↑ Adding Reload to the last last line of the hotkey will reload the script. It uses a .ini file so it knows upon reloading that it's should immediately execute without waiting for the hotkey to be pressed again.
See: https://www.autohotkey.com/docs/commands/Reload.htm
Code: Select all
IniRead, Restarted, restart.ini, Main, Restart, 0
if Restarted {
IniWrite, 0, restart.ini, Main, Restart
gosub, Main
}
return
#If Running
XButton2::
IniWrite, 1, restart.ini, Main, Restart
Reload
#If !Running
Main:
XButton2::
Running := 1
Send, 4
Sleep, 100
Send, 2
Sleep, 50
Click, Left, 1
Sleep, 100
Send, 8
Sleep, 2000
Send, 4
Running := 0
Return
Esc::ExitApp
Users browsing this forum: Bing [Bot], mikeyww and 357 guests