Re: Regex substitute/replace function in Applescript?
Re: Regex substitute/replace function in Applescript?
- Subject: Re: Regex substitute/replace function in Applescript?
- From: Gnarlodious <email@hidden>
- Date: Sat, 09 Oct 2004 08:45:48 -0600
Title: Re: Regex substitute/replace function in Applescript?
Entity Randall Perry spoke thus:
> What I'm wanting to do is read the source of an Entourage email and save it
> to a file, substituting the Mac eol character with Unix.
The part where it says “tr -s '\\r' '\\n'/” in this script is what you want:
tell application "Microsoft Entourage"
set theMsg to item 1 of (get current messages)
set subLine to the subject of theMsg
set subLine to do shell script "echo " & quoted form of the subLine & "| sed" & ¬
" -e 's|\\[.*\\] *||'" & ¬
" -e 's|\\(R[Ee]: *\\)\\{1,2\\}|~|'" & ¬
" -e 's|\\.$||'" & ¬
" -e 's|GraphicConverter ||'"
set the subject of theMsg to the subLine
set theContent to the quoted form of (get content of theMsg)
set theContent to do shell script "echo " & theContent & " | tr -s '\\r' '\\n' | sed" & ¬
" -e '/ Yahoo! Groups Sponsor/,/-~->/d'"
set the content of theMsg to theContent
end tell
-- http://Gnarlodious.com/Apple/AppleScript/Entourage/Yahoo.html
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden