Outlook message copy and clean - text
Embed
You can embed this paste into a blog or website with this code:
<iframe class="codetidy" type="text/html" width="100%" src="http://codetidy.com/paste/embed/1844" frameborder="0"></iframe>
#UseHook On

; paste all text into file and remove formatting

#a::

; Start off empty to allow ClipWait to detect when the text has arrived.

clipboard =

; Move focus from Outlook message list to message

Send, {TAB}

Sleep, 300

; Select all

Send, ^a

; Copy

Send, ^{ins}

; Wait 0.5 seconds for the clipboard to contain text.

ClipWait, 0

/* Replace newlines and carriage returns with a space. Don't get cute and

try to do it in one go - you'll regret it. */

StringReplace, clipboardt, clipboard, `n, %A_Space%, All

StringReplace, clipboardt, clipboardt, `r, %A_Space%, All

; Replace tabs with a space

StringReplace, clipboardt, clipboardt, %A_Tab%, %A_Space%, All

; Replace consecutive spaces with a single space

clipboardt := RegExReplace(clipboardt, "` {2,}", "` ")

; This has the effect of trimming leading and trailing whitespace

clipboardt = %clipboardt%

; Add the nice clean line of text to your file of choice

FileAppend, %clipboardt%`n, text_collect.txt

clipboardt =

; Switch back to the message list

Send, +{TAB}

return

#UseHook Off
