Re: Open Mail Attachments
Re: Open Mail Attachments
- Subject: Re: Open Mail Attachments
- From: "John R." <email@hidden>
- Date: Wed, 15 Feb 2006 17:03:16 -0500
I think I have solved my own problem by learning how to access
Spotlight results from Applescript.
This seems to open every attachment in selected emails in Mail:
tell application "Mail"
set MList to selection
set AList to {}
repeat with myMessage in MList
set AList to AList & every mail attachment of myMessage
end repeat
end tell
display dialog "OK to open this many files? ==> " & (count AList)
repeat with myA in AList
tell application "Mail" to set filename to name of myA
set myPath to paragraph 1 of (do shell script "mdfind kMDItemTitle
== '" & filename & "'")
set myFile to POSIX file myPath
tell application "Finder" to open myFile
end repeat
- John R
On Feb 15, 2006, at 10:25 AM, John R. wrote:
Because of the recent attention towards Mail Attachments on this
list, maybe some nice person could give me advice on a similar
subject. I posted this (see below) last month, but got no response.
Note: I did my own Google searches, and proposed various
alternatives that did not seem work for me. I presume a repeat
message 30 days later is "acceptable use" on this list!
On Jan 13, 2006, at 11:04 AM, John R. wrote:
Is there a way to open a Mail attachment through Applescript?
Plan A: Standard "Open" command does not work.
Below is a simple script (what AS is great for...) to open every
attachment among the selected messages
tell application "Mail"
set MList to selection
set AList to {}
repeat with myMessage in MList
set AList to AList & every mail attachment of myMessage
end repeat
open AList --> Script error from Mail
end tell
Plan B: Neither can I ask Finder to open it, because there is no
property for a full path to the attachment file in the Mail
folders - just the file name.
Plan C: Do I have to figure out how to save to a temporary folder
and open from there? Ugh.
Any better ideas?
Since then I have become comfortable with saving temporary files.
But I still can't get Mail to either open the file for me, or give
me a full path to where it is stored. I looked into whether
Spotlight could find it with just the filename, but I don't think
that will work either. Once again, any help would be appreciated...
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden