[Andy Fragen <[EMAIL PROTECTED]> schrieb am 24.9.2004 um 8:18 Uhr:]

>I really should remember to clean up my scripts instead of just copying
>and pasting. ;-)

It's OK. I changed it a little bit anyway to meet text I want to delete.
So I have to understand the script and I see your comments in another
color ...

>It was in there to specifically exclude HTML-type email. It turns out
>that if you get the message content of an HTML message via AppleScript
>the content is blank.

Strange!

>I found that out after having inadvertently deleted the content of
>several messages. Actually most of it was spam anyway. ;-)
>
>Here's a cleaned up version.

Thank you. But also this version would delete the HTML of Mails with
text/html or aletrnative/multipart!
So I think your lines

    property excludeHeaders : {"text/html", "multipart/alternative"}

and

    --some messages have no content per PM, but really do
    repeat with i from 1 to count of excludeHeaders
        if headers of msg contains item i of excludeHeaders then
            return
        end if
    end repeat

are useful and shall be put into your cleaned up version.

>BTW, the script REQUIRES the Satimage.osax and REQUIRES the exclusion
>criteria be valid regex (mostly).

I HAD this extension but didn't know it. Very useful if one knows a
little bit of regular expressions! Thanx again!


Subhash

P.S.:
Here the version of your script I would suggest (remove line breaks!). I
added also a line to delete ">" from otherwise empty lines:

<AppleScript>
--Delete From Content by Andy Fragen <[EMAIL PROTECTED]>
--Modified to use regex from Satimage.osax
--<http://www.satimage.fr/software/en/downloads_osaxen.html>
--Version 1.4

property addedContentRE : {"^/*.*CommuniGate.*$" & return, "^[\\> ]*--
?$" & return & "^.+$" & return & "^.*GMX.+$" & return, "^[> ]*-- ?$" &
return & ".*GMX.+$" & return & ".+$" & return, "[ ]*Signature powered by
Plaxo Want a signature like this?" & return & "[ ]*" & return & "[ ]*Add
me to your address book..."}

property excludeHeaders : {"text/html", "multipart/alternative"}

tell application "PowerMail"
        set theMessages to current messages
        repeat with msg in theMessages
                set mContent to content of msg as string
                
                --some messages have no content per PM, but really do
                repeat with i from 1 to count of excludeHeaders
                        if headers of msg contains item i of excludeHeaders then
                                return
                        end if
                end repeat
                
                if mContent = "" then
                        --display dialog ("\"" & subject of msg & "\" has no 
content per
PowerMail.")
                        return
                end if
                
                set mContent to change "^>[> ]*$" in mContent into " " with 
regexp --
delets ">" from empty lines
                
                repeat with i from 1 to the number of items of addedContentRE
                        try
                                set (content of msg) to change item i of 
addedContentRE in mContent
into "" with regexp
                        on error
                                display dialog ("Error stripping added content 
from message \"" &
subject of msg & "\"")
                        end try
                end repeat
        end repeat
end tell
</AppleScript>

-- 
http://www.subhash.at




Reply via email to