pawel
pawel

Reputation: 508

Autohotkey SendRaw adding EOL

AutoHotkey script to paste clipboard content as plain text(using windows+v), but it inserts extra EOL characters at each new line.

My script is:

#v::
  SendRaw %clipboard%
Return

I copied content like:

  1: bolded line
  2: italicized line2
  3. normal line

And expect it to paste:

  1: bolded line
  2: italicized line2
  3. normal line

But i get:

  1: bolded line

  2: italicized line2

  3. normal line

Please Note: the issue occurs in Windows 7 and 10 with AuthoHotkey v1.1.24.04

Upvotes: 0

Views: 384

Answers (1)

vafylec
vafylec

Reputation: 1015

  • In Windows, the EOL characters are usually CRLFs, that is, two characters: CR (carriage return, Chr(13)) and LF (linefeed, Chr(10)).
  • SendRaw interprets these as two enter keypresses that need to be sent to the window or control.
  • The workaround is to use the following code:

-

#v::
vText := Clipboard
StringReplace, vText, vText, `r`n, `n, All
SendRaw %vText%
Return

Upvotes: 4

Related Questions