OK. I have modified the script that Christian Roth posted and have run 
into a weird problem.

If I run it thru Script Editor - it works
If I set it as an incoming filter - it doesn't work. (the folder name 
is "-1")
If I *manually* run it via the "Mail / Perform Filter" - it works.

Any idea what I did wrong here?
(See script below)

Thanks,
Justin


<Snip>
global theFolder

tell application "PowerMail 5.2.3"
        set attachFolder to attachment folder
        set theMessages to current messages
        repeat with msg in theMessages
                set msgStatus to status of msg
                if (msgStatus is unread) or (msgStatus is confirmed) or 
(msgStatus is 
read) then
                        set attachList to attachments of msg
                        if (count items of attachList) > 0 then
                                set theDate to time received of msg
                                set msgAttachFolder to ""
                                set msgAttachFolder to msgAttachFolder & (ID of 
msg)
                                tell application "Finder"
                                        if not (exists folder (attachFolder & 
msgAttachFolder as string)) 
then
                                                set theFolder to (make new 
folder at attachFolder with properties 
{name:(msgAttachFolder as string)})
                                        else
                                                set theFolder to folder 
(attachFolder & msgAttachFolder as string)
                                        end if
                                end tell
                                repeat with attachIdx from (count items of 
attachList) to 1 by -1
                                        set attachFile to file of (item 
attachIdx of attachList)
                                        tell application "Finder"
                                                set newAttachFile to (move 
attachFile to theFolder without 
replacing) as alias
                                        end tell
                                        delete attachment attachIdx of msg
                                        make new attachment at msg with 
properties {file:(newAttachFile as 
alias)}
                                end repeat
                        end if
                end if
        end repeat
end tell
</Snip>





Reply via email to