I have a block of text containing multiple lines and want to send it to a chap app line-by-line. I want to have a procedure like this:
hotstringtrigger
), and AutoHotKey will send the first line (the text should stay in the input box of chat app)hotstringtrigger
is typed againSo far, my attempt is to split it into multiple hotstrings:
:*:hotstringtrigger::first line
:*:hotstringtrigger2::second line
:*:hotstringtrigger3::third line
...
But this has some disadvantages:
This page doesn't seem to cover this: Hotstrings - Definition & Usage | AutoHotkey
I guess very simple and straight forward example could be something like this
TextToSend := "
(
first line
second line
)"
lines := StrSplit(TextToSend, "`n", "`r")
:*T:hotstringtrigger::
SendInput,
(
Hello ____________________. Welcome to the World^{Home}{right 6}
)
i := 1
return
~Enter::
if (!i || i > lines.length())
return
SendInput, % "{Text}" lines[i]
i++
return
The input text is here simply typed into a continuation section and loaded from there to an array when the script starts. When your desired hotstring is ran, the index i
gets reset.
Then upon pressing Enter, text is sent from the array until our index, i
, is greater than the length of lines in the input string.
If your input text has very long lines, you should load the lines to your clipboard first, and then just send Ctrl + v.