Code: Select all
#SingleInstance force
objString1 := Object("HotstringTrigger", "f1#", "HotstringOptions", "X", "Content", "String1 default options (except execute)")
objString2 := Object("HotstringTrigger", "f2#", "HotstringOptions", "XCB0", "Content", "String2 case-sensitive, do not backspace")
objString3 := Object("HotstringTrigger", "f3#", "HotstringOptions", "X*", "Content", "String3 no ending key")
objHotstrings := Object()
Loop, 3
objHotstrings[":" . objString%A_Index%.HotstringOptions . ":" . objString%A_Index%.HotstringTrigger] := objString%A_Index%
for strHotstring in objHotstrings
{
Hotstring(strHotstring, "ShowObject") ; requires v1.1.28+ https://autohotkey.com/docs/commands/Hotstring.htm
strMessage .= strHotstring . "`n"
}
MsgBox, Hotstrings created:`n`n%strMessage%`nTo test these hotstrings, type "f1#" + space, "f2#" + space or "f3#" (no space required)
return
ShowObject:
StringSplit, arrHotstring, A_ThisHotkey, :
MsgBox, % "You typed """ . arrHotstring3 . """ with options """ . arrHotstring2 . """.`n`nIt triggered the command """ . A_ThisLabel . """ displaying the content of objHotstrings[A_ThisHotkey].Content: """ . objHotstrings[A_ThisHotkey].Content . """"
return