M
Mike D
This is a question for the Applescript gurus out there...
I wrote a script for deleting the attachments from a mail message
(below). I'm getting some weird behavior of the message size when
deleting the files by AppleScript, which I don't get when deleting
them manually with the "remove" button in the message.
As an example: I receive a mail with 3 attachments:
Attachment 1: 3 MB
Attachment 2: 2 MB
Attachment 3: 1 MB
When I select all the attachments in Entourage, then click on the
"remove" button, the message size goes to some trivially small size.
When I use the AppleScript, even though all the attachments are
supposedly deleted (according to the "History" in the message window),
the file size is reported as 5MB, reflecting only the change of
deleting the last attachment (the script starts at the last one and
goes to the first one, deleting them in order). The point is that
after deleting the first file in the list, the message size isn't
updated in Entourage.
This doesn't happen when deleting attachments manually, by selecting
them and hitting the "Remove" button in the message window.
Is there some AppleScript command to tell Entourage to recalculate the
message size? Is there another way to write the script to make it
correctly calculate the message size? This may sound like a trivial
problem, but at my work, we have a low limit on the size of our
mailboxes, and Entourage/Exchange thinks I have big files in my
mailbox when I don't.
Thanks!
--Mike
----- Script
tell application "Microsoft Entourage"
try
activate
set theMsg to item 1 of (get current messages)
set attachCount to count of the attachments of theMsg
set attachedFiles to the attachments of theMsg
repeat with i from attachCount to 1 by -1
set theAttachment to item i of attachedFiles
delete theAttachment
end repeat
end try
end tell
----- End Script
I wrote a script for deleting the attachments from a mail message
(below). I'm getting some weird behavior of the message size when
deleting the files by AppleScript, which I don't get when deleting
them manually with the "remove" button in the message.
As an example: I receive a mail with 3 attachments:
Attachment 1: 3 MB
Attachment 2: 2 MB
Attachment 3: 1 MB
When I select all the attachments in Entourage, then click on the
"remove" button, the message size goes to some trivially small size.
When I use the AppleScript, even though all the attachments are
supposedly deleted (according to the "History" in the message window),
the file size is reported as 5MB, reflecting only the change of
deleting the last attachment (the script starts at the last one and
goes to the first one, deleting them in order). The point is that
after deleting the first file in the list, the message size isn't
updated in Entourage.
This doesn't happen when deleting attachments manually, by selecting
them and hitting the "Remove" button in the message window.
Is there some AppleScript command to tell Entourage to recalculate the
message size? Is there another way to write the script to make it
correctly calculate the message size? This may sound like a trivial
problem, but at my work, we have a low limit on the size of our
mailboxes, and Entourage/Exchange thinks I have big files in my
mailbox when I don't.
Thanks!
--Mike
----- Script
tell application "Microsoft Entourage"
try
activate
set theMsg to item 1 of (get current messages)
set attachCount to count of the attachments of theMsg
set attachedFiles to the attachments of theMsg
repeat with i from attachCount to 1 by -1
set theAttachment to item i of attachedFiles
delete theAttachment
end repeat
end try
end tell
----- End Script