To avoid duplicate instances, I usually do not restart the script, but use the built-in Reload function. I run this with Ctrl + Win + Alt + R and use Ctrl + Win + Alt + E to edit the main AHK script.
^
Actually, my script looks like this:
^
In fact, all this is at the top of my script, I got this to give me a visual and audible indication of the restart of the script:
#SingleInstance Force #installKeybdHook #Persistent Menu, Tray, Icon , Shell32.dll, 25, 1 TrayTip, AutoHotKey, Started, 1 SoundBeep, 300, 150 Return
source share