Hikari
Hikari

Reputation: 3947

How do I send multilined text in Autohotkey?

This code pastes a 1-lined text when WINKEY + ALT + C is pressed:

#!c::
  SendInput, Some random text
Return

But I need to past a bigger text, with multiple lines.

Is there some kind of \n that I can use? It would be great if I could just have the exact text in the txt file and AHK paste it as-is.

Upvotes: 1

Views: 2870

Answers (1)

PGilm
PGilm

Reputation: 2312

Couple of ways.

  1. You could use a "continuation section" (explained about a third of the way down here)
#!c::
SendInput,
(
blah

    
    
    


blah
)
return
  1. Or you could use the explicit escaped line feed character `n:
#!c::
    SendInput, blah`n`n`n`n`n`nblah
return
  1. Or you could read a text file from disk and write that out (but you may have to change sendmode and/or handle characters in the text file that need to be escaped):
#!c::
    FileRead, blah, Path plus Name of Text File
    SendInput, %blah%
return

Upvotes: 8

Related Questions