Dr Dave wrote:
>because I eventually group all
>the attachments together by year (at least) so as to keep the current
>attachments folder less cluttered & easier to find recent attachments.
I have created a simple AppleScript to create a folder for each email
that has attachments and move attachments there. This way, attachments
(at least have a higher chance) to keep the original file names and not
get inserted a number like in test.zip, test 1.zip etc. when during the
months, people send attachments with identical names.
I have this set to run as the first filter on *any* incoming message.
It sure can be optimized, but I'm no AppleScript scripter. I also copied
portions of the default "Copy outgoing attachments" script. Maybe it is
of use to someone:
--snip--
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
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 & (year
of theDate)
set msgAttachFolder to msgAttachFolder & "-"
set msgAttachFolder to msgAttachFolder & (month
of theDate as number)
set msgAttachFolder to msgAttachFolder & "-"
set msgAttachFolder to msgAttachFolder & (day
of theDate as number)
set msgAttachFolder to msgAttachFolder & " "
set msgAttachFolder to msgAttachFolder &
(((time of theDate) / 3600)
as integer)
set msgAttachFolder to msgAttachFolder & "-"
set msgAttachFolder to msgAttachFolder &
((((time of theDate) mod
3600) / 60) as integer)
set msgAttachFolder to msgAttachFolder & " <"
set senderAddress to sender of msg
set msgAttachFolder to msgAttachFolder & (email
address of senderAddress)
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 if
end repeat
end tell
--snip--
Regards, Christian.