Is is possible to create hotstrings with the abbreviations and expanded value stored in variables? I need to store hotstrings in an ini file and retrieve/enable them from the ini file. I would need a command similar to the "Hotkey" command as illustrated in the example below. Without such a "Hotstring" command, is there another way to obtain the same result?
This is a working example. It will create an ini file named with with the script's filenname.
objHotkeyCommands := Object()
StringReplace, strIniFilename, A_ScriptFullPath, .ahk, .ini
IniWrite, !q, %strIniFilename%, Global, Hotkey
IniWrite, DoThis, %strIniFilename%, Global, HotkeyCommand
IniWrite, qq, %strIniFilename%, Global, Hotstring
IniWrite, Some text, %strIniFilename%, Global, HotstringText
; at some other point in the script
IniRead, strHotkey, %strIniFilename%, Global, Hotkey
IniRead, strHotkeyCommand, %strIniFilename%, Global, HotkeyCommand
IniRead, strHotstring, %strIniFilename%, Global, Hotstring
IniRead, strHotstringText, %strIniFilename%, Global, HotstringText
Hotkey, %strHotkey%, DoHotkey
; I know the "Hotstring" command below does not exit.
; But, if it would, it would do quite the same as the "Hotkey" command.
; Is there a way to obtain the same result?
; Hotstring, %strHotstring%, %strHotstringText%
; Here are a few alternatives that I put here for test
::ww::Some text ; this work
::%strHotstring%::%strHotstringText% ; "qq" does not work at all
gosub, % objHotkeyCommands[A_ThisHotkey]
MsgBox, strHotkey "%A_ThisHotkey%" executed
I've also reviewed this solution but it seems quite invasive (it triggers every key of your keyboard).
EDIT (2018-02-11): This is now possible with v1.1.28+. See the Hotstring function and this demo.