Remove blank line from clipboard

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
LogicNg
Posts: 20
Joined: 17 Mar 2021, 05:39

Remove blank line from clipboard

16 Apr 2021, 04:59

Code: Select all

msgbox %Clipboard%hi
Clipboard := RegExReplace(Clipboard, "`n+", "")
msgbox %Clipboard%hi
First message box:

Code: Select all

I am happy, are you?

hi
Clipboard has one line and one empty line, so I intentionally add a "hi" to test if the empty line is removed. The second message box returns the same message, which means RegExReplace doesn't work, can anyone point out what have I done wrong?
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Remove blank line from clipboard

16 Apr 2021, 07:17

Check if your input is using a `r instead of an `n character - ie in Notepad its usage will result in an extra line.

Code: Select all

StrReplace(clipboard,"`r","`r",NoChars)
MsgBox % "Clipboard contains " . NoChars . " `r-characters!"
Once Identified/validated you can replace them accordingly. HTH

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: arcylix, drani, Rohwedder, RussF and 232 guests