*This message was transferred with a trial version of CommuniGate(tm) Pro*
I wrote a script to trim stuff from incoming messages. It follows.

<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 addedContent : {"*This message was transferred with a trial
version of CommuniGate(tm) Pro*", "------------------------ Yahoo! Groups
Sponsor ---------------------~-->", "Get 128 Bit SSL Encryption!", "http:
//us.click.yahoo.com/", "------------
---------------------------------------------------------~->", "This is a
Manila site.. http://manila.userland.com/.";, "Your use of Yahoo! Groups
is subject to http://docs.yahoo.com/info/terms/ "}

property addedContentRE : {"^/*.*CommuniGate.*$" & return}
--property addedContentRE : {"^/*.*CommuniGate.*$", "^.*Yahoo!.*$.*", "^-
+~.*$"} --^.*Yahoo!.*$\\s*.*\\s.*\\s*.*^$

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

tell application "PowerMail 5.0.2b1"
        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
                
                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>

If you have similar words, etc. to delete from the content of every/most
incoming messages it works very well. If you want to use regex, you need
to have the free Satimage.osax installed.

Is this something like what you're looking for?
--
Andy Fragen

On Thu, Sep 23, 2004, Dr Dave said:

>Hello Subhash,
>
>I am also very interested in this script to trim the message content.
>
>Is it possible that "Postzentrale" or "Post Office" might be the name of
>the top mail folder; "In Tray"? Or maybe "Mail Browser"?
>
>What is this Script trying to do at that point?
>Is it checking to see if we are looking at the list of emails, or an open
>email?
>In the US English version when I look at the list of emails: the window
>title is "Mail Browser: Name of folder".
>
>If we are looking at an open email message, the window title is only the
>message subject.
>
>Best,
> Dave Nathanson
> Mac Medix
>
>
>in reply to ([EMAIL PROTECTED]), computer artwork by subhash's message of
>12:10 AM, 9/23/04
>
>>
>>You cannot edit an incoming message manually, only per AppleScript. There
>>is a Script tu shrink the content to the selected content. Maxbe that is
>>what you want. Unfortunately I do not remeber the name (I renamed it to
>>German). Here it is (ah I see it also is written originally by the famous
>>cheshirekat). You have to change the German terminus "Postzentrale" to
>>the appropriate english word ("poststation"???).
>>
>><start AppleScript>
>>
>>-- created by [EMAIL PROTECTED]
>>-- angepasst von Subhash ([EMAIL PROTECTED])
>>
>>to getTextFromPM()
>>      tell application "PowerMail"
>>              return (the selection of the front window)
>>      end tell
>>end getTextFromPM
>>
>>to getTargetMsg()
>>      tell application "PowerMail"
>>              return (the displayed message of the front window)
>>      end tell
>>end getTargetMsg
>>
>>to getMsgContent(targetMsg)
>>      tell application "PowerMail"
>>              --              set the targetMsg to the displayed message of 
>> the front window
>>              return (the content of the targetMsg)
>>      end tell
>>end getMsgContent
>>
>>to alterPMMsg(targetMsg, selectedTxt)
>>      tell application "PowerMail"
>>              if name of the front window does not contain "Postzentrale" then
>>                      close the front window
>>              end if
>>              set content of the targetMsg to the selectedTxt
>>              if name of the front window does not contain "Postzentrale" then
>>                      open the targetMsg
>>              end if
>>      end tell
>>end alterPMMsg
>>
>>tell application "PowerMail"
>>      if (exists (the displayed message of the front window)) and ¬
>>              (exists (the selection of the front window)) then
>>              set the selectedTxt to my getTextFromPM()
>>              set the targetMsg to my getTargetMsg()
>>              set the msgContent to my getMsgContent(targetMsg)
>>              my alterPMMsg(targetMsg, selectedTxt)
>>      else
>>              say "Unable to comply. Open message and selected text required."
>>      end if
>>end tell
>>
>><end AppleScript>
>>
>>--
>>http://www.subhash.at
>>
>>
>>
>
>
>




Reply via email to