My main script is AutoHotkey.ahk. Sometimes it runs into trouble and Pauses itself. Then I have to right-click on the red taskbar icon and select 'Reload this Script'. This always works fine. The script is back to square one, it just hangs out waiting for me to give input, and (importantly) it's not in the middle of the procedure that led it into trouble. The only problem is that it's annoying to have to right-click every time the script runs into trouble. I'd prefer to be able to type something like 'sss' and have that do the very same thing that right-clicking and selecting 'Reload this Script' does.
So here's what I have in a second script:
Code: Select all
:?*:sss::
Sleep, 300
DetectHiddenWindows, On
WinClose, %A_ScriptDir%\AutoHotkey.ahk
Sleep, 500
Run, %A_ScriptDir%\AutoHotkey.ahk " /restart" ; I've also tried this line without the quotation marks, and with /force added
return
But this doesn't work. Admittedly, it successfully closes the main script and then runs it again. But it doesn't reload the main script from square one. Instead, the main script picks up where it left off, and continues with the procedure that led it into trouble. This is exactly what I
don't want to happen.
Does anyone know an easy way to have a second script that accomplishes the same thing that is accomplished by right-clicking my main script's red paused taskbar icon and selecting 'Reload this Script'? Thanks!