Edit a script

with AutoHotkey

by Philippe Lamarre
last updated June 6, 2014
difficulty.png Easy

by Philippe Lamarre

Description

One of the very useful AutoHotkey features is the ability to add/modify scripts on the fly. This script is for those who constantly edit their AutoHotkey file to put in new scripts or modify already existent ones.

Adding or modifying a script in your AHK file is a three-step process (edit, save, reload) and having the scripts presented below will help you do it quicker. 

Note: AutoHotkey has no limits when it comes to automation in Windows, but for many users who may only need simple keyboard shortcuts, installing and learning AutoHotkey, and keeping up to date, can be overkill. ShortKeeper can be used (with and without an Enterpad) to manage an AutoHotkey-based system in a way most non-programmers will find remarkably user-friendly and and effective [learn more].

Steps

1

overlay-um-edit.gifPrepare your overlay
Choose two free keys on the Enterpad to use to edit your AutoHotkey script and then to save and reload it. You can name it Edit and Save&Reload.

2

Code installation

Copy/paste the following scripts in your AutoHotkey file template (Enterpad.ahk) at the chosen key location.

001:
Edit
Return

Copy/paste the following scripts in your AutoHotkey file template (Enterpad.ahk) at the chosen key location, even though I suggest you put it right next to your Edit script.

002:
Send ^s
Reload
Return

More Info

If you want to make sure the Save & reload script does not reload without saving, you can add a delay between the save and reload commands in your script. It looks like this :

001:
Send ^s
Sleep, 1000
Reload
Return

If you press the Save & reload script while you have an error in your script (for example if your forget to put ` in front of a percent sign in an URL) an error box will indicate you where is your error, what it is and it will tell you that the script was not reloaded. Therefore, the old version will remain in effect.