• Intro to AutoHotkey HotStrings with AutoHotkey Intermediate AutoHotkey GUIs are Easy with AutoHotkey Intro to DOS & AutoHotkey AutoHotkey FAQ AutoHotkey FAQ

AutoHotkey Webinar- Using Controls with AHK

Controls in AutoHotkeyVideo Hour 1: High-level overview: Hour 1
Video Hour 2: Q&A: Hour 2

Script Highlight: WinSpy from Alguimist.  Forum version here

SimpleSpy version here

Also, check out all the other tutorials on Controls with AutoHotkey here

Here are the scripts we walked through during the webinar

Getting & Setting Text with Controls in AutoHotkey

ControlSetText,ComboBox1,Cool,ahk_exe notepad.exe ;Set Text
ControlSetText,Edit1,Cool,ahk_exe notepad.exe ;Set Text
ControlSetText,Sample,This is Cool,ahk_exe notepad.exe ;Set Text
ControlGetText,Var,ComboLBox1,Font ahk_exe notepad.exe ;Get Text
ControlGet,var,Choice,,ComboLBox1,ahk_exe notepad.exe
MsgBox % Var
ControlSend,ComboBox1,Just a test,ahk_exe notepad.exe ;Sending keystrokes
ControlSendRaw,ComboBox1,Just a test!,ahk_exe notepad.exe ;Sending keystrokes

;********************Main Edit window- Get specific line***********************************
ControlGet, OutputVar, Line, 2, Edit1, ahk_exe notepad.exe
MsgBox % OutputVar

Checking / Selecting Controls with AutoHotkey

;******Notepad Find / Replace********************************
ControlGet, Var,checked,,Button5, ahk_exe notepad.exe ;See if "Up" is Checked in Find/replace
MsgBox % Var
Control, Check ,, &Up, ahk_exe notepad.exe ;Click "Down" in Find/replace

ControlGet, Var, Checked ,, Button5, ahk_exe notepad.exe ;See if "Up" is Checked in Find/replace
MsgBox % Var
sleep, 1000
Control, Check ,, Button6, ahk_exe notepad.exe ;Click "Down" in Find/replace

Control, Check ,, Button2, ahk_exe notepad.exe ;Click "Down" in Find/replace
Control, UnCheck ,, Button2, ahk_exe notepad.exe ;Click "Down" in Find/replace
sleep, 1000
Control, UnCheck ,, Button2, ahk_exe notepad.exe ;Click "Down" in Find/replace
Control, UnCheck ,, Match case, ahk_exe notepad.exe ;Click "Down" in Find/replace

Getting Text from a ListView Control in AutoHotkey

;********************GrepWin Listview***********************************
;~ ; Get the row of first selected item  in listviewi
ControlGet,Var,List,Selected,SysListView321,ahk_exe ahk_exe grepWin-1.9.1_portable.exe
ControlGet,Var,List,Count,SysListView321,ahk_exe ahk_exe grepWin-1.9.1_portable.exe
MsgBox % var

;********************Getting specific columns / rows***********************************
ControlGet, SelectedItems, List, Selected, SysListView321, ahk_exe grepWin-1.9.1_portable.exe
Loop, Parse, SelectedItems, `n  ; Rows are delimited by linefeeds (`n).
	RowNumber := A_Index
	Loop, Parse, A_LoopField, %A_Tab%  ; Fields (columns) in each row are delimited by tabs (A_Tab).
		MsgBox Row #%RowNumber% Col #%A_Index% is %A_LoopField%.


Comments are closed.