Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hotkey to restart autohotkey script?

Tags:

autohotkey

Say I have an autohotkey script C:\path\to\my\script running. Is there a way to define a hotkey that re-starts it?

like image 542
Amelio Vazquez-Reina Avatar asked Mar 29 '13 15:03

Amelio Vazquez-Reina


People also ask

How do I stop an AutoHotkey script from running?

You can use a suspend AutoHotkey function, just press [ESC] and the script stop working, press again and it works.

Why is my AutoHotkey script not working?

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.


1 Answers

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
like image 98
Robert Ilbrink Avatar answered Sep 29 '22 09:09

Robert Ilbrink