Here is a modified version of the original script that moves mails with
certain attachment to the Spam foolder:

--Remove Listed Attachments by Andy Fragen <[EMAIL PROTECTED]>
--v.1.0
-- olaf's modified version 2004-04-28

property badAttachment : {".scr", ".inf", ".exe", ".pif", ".com", ".bat"}
property spamFolderName : "Spam"

tell application "PowerMail"
        set theMessages to current messages
        repeat with msg in theMessages
                if exists (attachments of msg) then
                        my MoveBadAttachmentToSpam(badAttachment, msg)
                end if
        end repeat
end tell

on MoveBadAttachmentToSpam(propList, msg)
        tell application "PowerMail"
                repeat with attach in every attachment of msg
                        repeat with i from 1 to the number of items of propList
                                ignoring case
                                        --if (name of attach begins with item i 
of propList) or (name of
attach ends with item i of propList) then
                                        if (name of attach contains item i of 
propList) then
                                                --display dialog ("Found match: 
" & name of attach & ":" & id of msg)
                                                move msg to message container 
spamFolderName
                                        end if
                                end ignoring
                        end repeat
                end repeat
        end tell
end MoveBadAttachmentToSpam

Olaf

[EMAIL PROTECTED] wrote Thu, 29 Apr 2004 07:49:31 -0400

>I am using PM 4.2.1 on Mac OS 9.0.4.  I have tried downloading this
>script several times with 3 different browsers.  When I unstuff the file
>(Stuffit Expander 5.5 or 7.0.3) and try to open it, I get errors.  With
>Script Editor, I get a 'disk error'.  When I use Smile, I get an error -
>39.  Other scripts that I download from this site open without problems.
>
>Now - What I really want to do is to move messages (not just the
>attachments) having attachments with specific suffixes to a folder (e.g.
>- Mail Trash or one named 'Spam').
>
>I, too have worked in several programming languages (BASIC, FORTH, and
>several scripting languages), but have not found myself compatible with
>AppleScript, so any assistance would be welcome.
>
>Thanks!
>
>On Thursday, April 29, 2004, [EMAIL PROTECTED] was rumored to
>have said:
>
>>>The new version of PM (v5, currently available as a beta) lets you do
>>>this straight from the filter setup box. Under PM 4.x, however, the best
>>>way is to use the apple script "Remove Listed Attachments", which you can
>>>download from the PM Applescript archive on Wayne Brissette's invaluable
>>site.
>>><http://homepage.mac.com/wayneb/powermail.html>
>
>
>
>


Reply via email to