Quantcast
Channel: AutoHotkey Community
Viewing all articles
Browse latest Browse all 579

Scripts and Functions (v1) • Re: Remove line breaks while copying (Convert multiple lines to one line)

$
0
0
I was using a similar script to remove line breaks when copy/pasting but your script is working much better mine does, so, thank you!

I did make a small tweak because I was getting some cases where there was a missing space between words but this can be solved by substituting the "" with A_Space, which automatically trims out extra spacing (if I'm reading the documentation correctly). https://www.autohotkey.com/docs/v1/lib/AutoTrim.htm

CODE:

#NoEnv 
; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.

^c:: Suspend, On ; Suspend this scripts so the following ^c becomes a normal copy
Clipboard =
Send, ^c
Sleep, 50 ; Wait for clipboard
Clipboard := RegExReplace(Clipboard, "\r\n|\r|\n", A_Space)
Suspend, Off
return


In any case, this saved me a lot of time and I really appreciate it! :)

Statistics: Posted by mattersen — Today, 11:49



Viewing all articles
Browse latest Browse all 579

Trending Articles