I am quite new on AutoHotKey, and I'm trying to make my macro system. Currently I have a system that looks like this: I have text variables
hi =
(
Hello,
Some more text
)
a Hotstring
::\hi::
Macro(hi)
return
And a function Macro
:
Macro(text)
{
ClipSaved := ClipboardAll ; save clipboard
clipboard := text
ClipWait
Sleep, 150
Send, ^v
clipboard := ClipSaved ; restore original clipboard
return
}
The reason for using a function with clipboard is because long text blocks tend to have a delay until they are printed out, an issue that does not occur with the function.
I've found a concept called dynamic hotstrings, and I think I can somehow implement it so that I wouldn't have to write the second displayed block for every text field, but instead have a one hotstring that would understand that if it's my input starts with \
and there is a variable in the script under the name x
that follows it, it should execute Macro(x)
, but I have never found any similar examples.
Could you provide me with a code sample or give any leads to what I should check out?