• Become a Power user Intro to AutoHotkey Intermediate AutoHotkey Intermediate Objects GUIs are Easy w/AutoHotkey Painlessly switch from V1 to V2

I can’t tell you the # of times AutoHotkey Variadic Functions come in handy

AutoHotkey Variadic FunctionsAutoHotkey Variadic Functions can be incredibly handy when you don’t know the exact number of parameters.   The below example shows some simple math where you can pass any number of parameters to be added.  It also demonstrates how you can use MaxIndex() to determine how many parameters were passed to the function.

;***********variadic function******************* 
MsgBox % math(1,2)
MsgBox % math(1,2,3)
MsgBox % math(1,2,3,4)

	for k, y in X
		tot:=y + tot 
	loop, % x.MaxIndex() ;Loop over the # of parameters that exist
		Indiv.=	x[A_Index] "+"
	return SubStr(Indiv,1,(StrLen(Indiv)-1)) "=" tot ;use substr to remove the last + sign

AutoHotkey Merchandise-White Stress ballDemonstration using AutoHotkey Variadic Functions

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

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


How to use optional parameters in AutoHotkey Functions

optional parameters in AutoHotkey FunctionsFunctions in AutoHotkey rock!  Some functions though have items that either 99% of the time are the same value or are things that you rarely use.  In this case using optional parameters in AutoHotkey Functions is a great way to simplify your code!  Just remember that the optional parameters have to be listed after all of the required parameters.

In the below video I demonstrate how to set defaults and pass optional params to an AutoHotkey function.

Optional parameters in AutoHotkey functions