Remove line breaks

Share your favorite FastKeys commands
Post Reply
kmaustral
Posts: 4
Joined: Jun 22nd, ’22, 02:49

Post by kmaustral » Jun 22nd, ’22, 02:53

I can't seem to find this function in the Library or Forum.

It's a matter of replacing line breaks with a space. This would transform a paragraph of broken sentences as normally found in a PDF to a continuous flow of words.

Ideally, it keeps paragraphs, which are usually double line breaks.

Any ideas? :roll:
User avatar
Marko
Posts: 1718
Joined: Mar 2nd, ’13, 21:02

Post by Marko » Jun 24th, ’22, 14:02

This replaces all line breaks in the selected text with spaces (tries to preserve double breaks):

Code: Select all

Clipboard:=""
Send, ^c
ClipWait
string:=clipboard
stringreplace, string, string, `r`n`r`n, ♥, all
stringreplace, string, string, `r`n, %A_Space%, all
stringreplace, string, string, ♥, `n`n, all
SendInput, % string
kmaustral
Posts: 4
Joined: Jun 22nd, ’22, 02:49

Post by kmaustral » Jul 1st, ’22, 06:24

Thank you so much!
Post Reply