Running Your First AutoHotkey Script
AutoHotkey (AHK) is an incredible open-source Windows scripting tool that lets you create hotkey shortcuts, text expansions, macros, GUIs, workflow automations, and lots more.
Installing AutoHotkey
- Go to https://www.autohotkey.com/ to download, select Download Current Version, and save the file.
- Run the installation file by double-clicking it from your downloads folder, and select Express Installation.
- Once AutoHotkey installs, click Exit.
Create Your First AutoHotkey Script
- Navigate to your Documents\AutoHotkey folder or wherever you would like to place your scripts.
- Right-click and select New >> AutoHotkey Script. Save the filename as whatever you would like, for instance, “My_First_AHK_Script.ahk“.
- Right-click on your new script and click Edit. The script will open in your default text editor (Notepad, Notepad++, etc.)
- Your AHK script will have a few lines of code at the top. Underneath those, copy and paste the following:
!t::
Send This is my first AutoHotkey script.
return
This defines a new hotkey that triggers when ALT+t is pressed (ALT is represented as the ! sign)
- Save your script, and then double-click on the script file to run it.
- Now that your script is running, whenever you press ALT+t, it will send “This is my first AutoHotkey script” as if you had typed it. You can try it out anywhere that accepts keyboard input, like OneNote:
HAPPY SCRIPTING!