Tips & Tricks for using functions in AutoHotkey

functions in AutoHotkeyAutoHotkey Merchandise-White Stress ballFunctions in AutoHotkey are a great tool to have in your bag!  They can definitely help simplify your code, ease re-purposing of code and avoid a lot of simple mistakes by keeping the variables local (instead of global).  AHK Studio is an editor written in and for AutoHotkey.  It helps both noobs & gurus write great code and is worth a deep look!

The below video reviews a few tips & tricks for working with functions.

Functions in AutoHotkey

Clear AutoHotkey water bottle with green lid and band, showing impact resistance, BPA free, fade resistant, and durability claims

Streamline your code by Utilizing Includes in AutoHotkey

how to use Includes in AutoHotkeyAs I previously reviewed, functions in AHK rock!  The below video demonstrates how easy it is to use the utilize the includes in AutoHotkey to leverage functions & libraries that are not in your main file.

Without using the include command AHK will first look in your local library, then look under the myDocuments\AutoHotkey\Lib\ folder and finally under path-to-running-AutoHotkey.exe\lib\.

Includes in AutoHotkey

 

 

 

 

 

By using the #Include Directive you specifically tell AHK to “include” the file in your script.  Using Includes in AutoHotkey is an amazing way to keep your code clean and organized.

Using Includes in AutoHotkey

 

Intro tutorial on using AutoHotkey functions to streamline code

AutoHotkey functionGroup of coworkers seated around a table in a bright office, talking together with a green reusable water bottle in front of themAutoHotkey functions are a true gem that help streamline your code, make it more readable, easier to maintain, and avoid conflicts with other variables (because their scope is local by default.  They take a little practice getting used to however they can save a ton of time and allow for re-using a ton of code.   Don’t get hung-up on writing them at the beginning of your script.  Often I go back after writing my script and realize I should have written a function in place of a subroutine.

My first video on AutoHotkey functions explains why & how you can use them.

Bearded man in denim shirt and woman in white top reviewing papers and a laptop together at a desk with coffee