Re: Saving Attachment from Mail.app
Re: Saving Attachment from Mail.app
- Subject: Re: Saving Attachment from Mail.app
- From: cricket <email@hidden>
- Date: Fri, 21 Mar 2003 09:29:03 -0800
Looks like you're doing everything correctly. My only suggestion would
be to possibly explore a shell script alternative, which I've
personally found to be much faster than the built-in 'write to file'
functionality.
A code snippet:
on writeSource(s)
set theSavedClipboard to the clipboard as record
set the clipboard to s
do shell script "pbpaste > ~/Desktop/temp.txt"
set the clipboard to theSavedClipboard
-- then process with Stuffit Expander
end writeSource
- cricket
On Friday, March 21, 2003, at 12:18 AM, Alan Kimelman wrote:
I would like to explore the issue of saving an attachment from
Mail.app.
Although I have used the following script, successfully, I find that
writing the source of a mail message to a file significantly slows the
process. This script works, but is slow.
on perform_mail_action(info)
tell application "Mail"
set selectedMessages to |SelectedMessages| of info
repeat with eachMessage in selectedMessages
set s to source of eachMessage
end repeat
end tell
my writeSource(s)
end perform_mail_action
on writeSource(s)
set f to "" & (path to desktop) & "temp.txt"
set my text item delimiters to ASCII character 10
set ls to text items of s
set my text item delimiters to return
set s to ls as string
set my text item delimiters to ""
try
close access file f
end try
open for access file f with write permission
set eof file f to 0
write s to file f
close access file f
set DestinationFolder to (path to desktop)
tell application "Stuffit Expander"
Expand {alias f} Destination alias DestinationFolder
end tell
end writeSource
Some time ago, Cricket wrote that one can save the raw source of a
message to a file, and send a fileRef to Stuffit Expander, which
extracts the attachments.
I did not understand how to save the raw source of the message to a
file.
If this would accelerate the process, could someone explain that
method?
Thanks
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
----->
Software Entomologist Mail for Mac OS X
http://www.apple.com/macosx/jaguar/mail.html
---------->
Late rains drown me in their desperate tantrums.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.