Try this
Clipboard:=TF_InsertPrefix(TF_Wrap(RegExReplace(RegExReplace(RegExReplace(Clipboard,"(\r?\n){2,}","__nl__"),"(\r?\n)"," "),"__nl__","`n`n"), 73), "", "", "> ")
The triple nested RegExReplace does this:
- replace all duplicate empty lines with __n__ this marks the paragraphs which we would like to keep
- replace all remaining new lines with a space so all lines are unwrapped to one long line
- replace all paragraph markers __n__ with two empty lines leaving us with single line paragraphs
- which are passed on to TF_Wrap as before...
Ok, after some tests following result, 2 separate steps needed:
First step:
Cleaning up mail text and wrapping to specified number of cols.
Second step:
Adjusting incomplete, not filled lines.
It must be done in two separate steps because macro doesn't know untouchable mail parts like head, signature...
After formatting and cleaning the broken Outlook reply, context of small and not filled lines must be marked, then apply by AHK-hotkey:
#Include tf.ahk
SetTitleMatchMode 2
WinWait, - Nachricht (Nur-Text) ,
IfWinNotActive, - Nachricht (Nur-Text) , , WinActivate, - Nachricht (Nur-Text) ,
WinWaitActive, - Nachricht (Nur-Text) ,
Sleep, 200
Send, {CTRLDOWN}c{CTRLUP}
StringCaseSense On
StringReplace clipboard, clipboard, `n>%A_Space%>%A_Space%>%A_Space%, `n, all
StringReplace clipboard, clipboard, `n>%A_Space%>%A_Space%, `n, all
StringReplace clipboard, clipboard, `n>%A_Space%>, `n, all
StringReplace clipboard, clipboard, `n>%A_Space%, `n, all
StringReplace clipboard, clipboard, `n>`n, `n, all
Clipboard:=TF_InsertPrefix(TF_Wrap(RegExReplace(RegExReplace(RegExReplace(Clipboard,"(\r?\n){2,}","__nl__"),"(\r?\n)"," "),"__nl__","`n`n"), 73), "", "", "> ")
StringReplace clipboard, clipboard, >%A_Space%>%A_Space%, >%A_Space%, all
Send, {CTRLDOWN}v{CTRLUP}
Sleep, 100
Send, {CTRLDOWN}{HOME}{CTRLUP}
Marked text will be reformatted with filled up lines with a leading >
in front of each row, line break at specified col.
Thx for help.