Re: How can I open attachment in Mail ?
Re: How can I open attachment in Mail ?
- Subject: Re: How can I open attachment in Mail ?
- From: Victor Frenklakh <email@hidden>
- Date: Wed, 25 Oct 2006 17:09:48 -0700
Hi Kai,
You helped me.
Thanks so much.
Thanks,
Victor Frenklakh
650-467-3508
email@hidden
On Oct 22, 2006, at 6:02 PM, kai wrote:
On 19 Oct 2006, at 18:00, Victor Frenklakh wrote:
I need to open attached file coming to inbox. Do you know any
build in method to do it?
It's probably not such a great idea to open attachments
indiscriminately, Victor - so you may want to consider applying
some rules that offer a degree of security. (You could, for
example, limit automatic opening to only those attachments received
from trusted sources.)
When you open an attachment by clicking it in a message, Mail
temporarily saves it as a separate file to your Mail downloads
folder (the default location of which is /Users/user name/Library/
Mail Downloads/). One way of achieving your aim might therefore be
to simulate that process using AppleScript.
The script below is intended to be triggered by a Mail rule, so (in
case you're unsure) you'll need to:
------------------
• save the script (File Format: Script) to a suitable location
• add a new rule in Mail/Preferences.../Rules
• specify the relevant conditions for the rule
• from the options under "Perform the following actions:", select
"Run AppleScript"
• click the "Choose..." button
• choose the script you just saved
------------------
Here's the script:
------------------
on download_path()
set f to (do shell script "defaults read com.apple.mail
MailDownloadsPath") & "/"
if f does not start with "~" then return f
set h to POSIX path of (path to home folder)
if (count f) < 3 then return h
h & f's text 3 thru -1
end download_path
on unique_name(n, l)
if n is in l then
if "." is in n then
set d to text item delimiters
set text item delimiters to "."
set e to "." & n's text item -1
set n to n's text 1 thru text item -2
set text item delimiters to d
else
set e to ""
end if
set v to -1
repeat while n & v & e is in l
set v to v - 1
end repeat
set l's end to n & v & e
else
set l's end to n
end if
end unique_name
using terms from application "Mail"
on perform mail action with messages msgs
set p to POSIX file download_path() as Unicode text
set l to list folder p without invisibles
repeat with m in msgs
repeat with a in m's mail attachments
set f to p & unique_name(a's name, l)
save a in f
tell application "Finder" to open f
end repeat
end repeat
end perform mail action with messages
end using terms from
------------------
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden