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?

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
Marko wrote: ↑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
Code: Select all
Clipboard:=""
Send, ^c
ClipWait
string:=clipboard
Loop
{
StringReplace, string, string, %A_Space%%A_Space%, %A_Space%, UseErrorLevel
if ErrorLevel = 0 ;no more replacements needed
break
}
SendRaw, % string
Code: Select all
Clipboard:=""
Send, ^c
ClipWait
string:=clipboard
string:=Trim(RegExReplace(string, "\h\K\h+"))
SendRaw, % string