Say I have an autohotkey script C:\path\to\my\script
running. Is there a way to define a hotkey that re-starts it?
You can use a suspend AutoHotkey function, just press [ESC] and the script stop working, press again and it works.
If you re-installed and it didn't fix the issue, then it seems likely that the issue is with a security program that has flagged autohotkey.exe as a possible virus. See if you can find the autohotkey folder and see if there is a .exe file there.
In order to prevent duplicate instances, I normally do not re-launch a script but use the build-in function Reload. I launch this with Ctrl+Win+Alt+R and use Ctrl+Win+Alt+E to edit the main AHK script.
^#!r::Reload
Actually, my script looks like this:
^#!r::
Send, ^s ; To save a changed script
Sleep, 300 ; give it time to save the script
Reload
Return
^!#e::Edit
As a matter of fact, all the way at the top of my script I have this to give me a visual and audio indication that the script was restarted:
#SingleInstance Force
#installKeybdHook
#Persistent
Menu, Tray, Icon , Shell32.dll, 25, 1
TrayTip, AutoHotKey, Started, 1
SoundBeep, 300, 150
Return
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With