Edit a script

with AutoHotkey

by Philippe Lamarre
last updated August 12, 2018
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 document is for those who are constantly editing their AutoHotkey file, adding new scripts or modifying existing ones.

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

Steps

1

overlay-um-edit.gifPrepare your overlay
Choose two unassigned keys on the Enterpad overlay where you will assign the two scripts. You can name them Edit and Save&Reload.

2

Code installation

Copy and paste the following script in the AutoHotkey script template file “Enterpad.ahk” at the location of the first key you wish to assign.

001:
Edit
Return

Do the same with the following script at the location of the second key you wish to assign.

002:
Send ^s
Reload
Return

More Info

If you want to make sure the Save&Reload script has enough time to save before reloading, you can add a pause between the save and reload commands in your script. With a pause, it would look like this:

001:
Send ^s
Sleep, 1000
Reload
Return

If there is an error in your edited script and you press the Save&Reload button, a dialog box with information about the error will appear. In such a case, the old version of the script will remain in effect.