Here it is. It does have some issues:

On older versions of PowerMail, having it set as an outgoing rule might
crash PowerMail.

And if you set it as a rule for all incoming, all the attachments will go
into a folder named "-1" (issue w/ Finder & Powermail).

I just run it every few weeks to *fix* the folders from the "-1" to the
"correct" folder.

Please be careful and test it before implementing. :)

Justin Beek

<START>

global theFolder

tell application "PowerMail"
set attachFolder to attachment folder

set theMessages to current messages
repeat with msg in theMessages
set msgStatus to status of msg

set attachList to attachments of msg
if (count items of attachList) > 0 then
set theID to the ID of msg
set msgAttachFolder to ""
set msgAttachFolder to theID
set msgAttachFolder to msgAttachFolder

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 repeat
end tell

<END>

On 11/27/07 12:37 PM, "Ben Kennedy" <[EMAIL PROTECTED]> wrote:

> Justin,
> 
> This sounds very useful.  Can you share?
> 
> -ben
> 
> Justin Beek wrote at 10:33 AM (-0600) on 11/27/07:
> 
>> I have a script that will move the attachments in the messages to separate
>> folders based on the Message ID Number.
>> 
>> After you run the script on all your messages, any files leftover *should*
>> be safe to trash.
>> 
>> It's a pretty nice script for Spring Cleaning. For example, if you have 5
>> messages with 5 attachments each, you'll end up w/ 5 folders instead of 25
>> files.
>> 
>> Good Luck,
>> Justin
>> 
>> 
>> On 11/27/07 10:18 AM, "Bill Courington" <[EMAIL PROTECTED]> wrote:
>> 
>>> Is there such a thing? I've got about a zillion files in the Attachments
>>> folder and I'm pretty sure (not positive) that many of them belong to
>>> trashed messages.
>>> 
>>>   Bill
>>> 
>>> 
>>> 
>>> 
>> 
>> 
>> 
>> 
>> 





Reply via email to