Tutorial by Examples

;Sends the keystroke for the letter "a" every 3 seconds. #Persistent SetTimer, SendLetterA, 3000 return SendLetterA() { Send, a }
This is an example of something that would have been straight up impossible with labels. If you execute the same label multiple times at the same time and they rely on variables that are being defined within them, they very likely interfere and cause unexpected behavior. Here is how to do it with f...
Example showing how to create Guis using functions instead of labels. Gui, Add, Button, gCtrlEvent vButton1, Button 1 Gui, Add, Button, gCtrlEvent vButton2, Button 2 Gui, Add, Button, gGoButton, Go Button Gui, Add, Edit, vEditField, Example text Gui, Show,, Functions instead of labels CtrlEv...
Examples of using functions with hotkeys: Hotkey, a, MyFunction ; Calls MyFunction() when a is pressed MyFunction() { MsgBox You pressed %A_ThisHotkey%. } Or: a::MyFunction() MyFunction() { MsgBox You pressed %A_ThisHotkey%. }
#Persistent Menu, Tray, NoStandard ; remove default tray menu entries Menu, Tray, Add, MyDefaultAction, OnDefaultTrayAction ; add a new tray menu entry Menu, Tray, Add, Exit, Exit ; add another tray menu entry Menu, Tray, Default, MyDefaultAction ;When doubleclicking the tray icon, run the tra...
I'll demonstrate the basic usage of using functions vs using labels+gosub. In this example we'll implement simple functionality to add two numbers and store them in a variable. With functions: c := Add(3, 2) ; function call MsgBox, Result: %c% Add(a, b) { ; This is a function. Put it wherever...
The following code is taken from he official AutoHotkey documentation: Function implementation: #Persistent OnClipboardChange("ClipChanged") return ClipChanged(Type) { ToolTip Clipboard data type: %Type% Sleep 1000 ToolTip ; Turn off the tip. } Label implementati...
This script demonstrates how to receive complicated GUI events from different controls in the same event callback function. We'll be using two ListView controls for that. Now every time an action is detected on one of those ListView controls, we want a precise description of what happened and have ...

Page 1 of 1