Re: Saving Attachements to a folder
Re: Saving Attachements to a folder
- Subject: Re: Saving Attachements to a folder
- From: Michelle Steiner <email@hidden>
- Date: Mon, 20 Aug 2007 15:57:38 -0700
On Aug 20, 2007, at 12:21 PM, has wrote:
set folderPath to "MacOSX:Users:ronny:Desktop:Target:"
tell application "Mail"
repeat with msgRef in (get selection)
repeat with attachmentRef in mail attachments of msgRef
set filePath to (folderPath & name of attachmentRef) -- note:
assumes attachment name doesn't contain colons
save attachmentRef in filePath -- note: will raise an error if
file already exists
end repeat
end repeat
end tell
Nice.
Here is a minor modification to it.
set folderPath to (path to desktop) as text
tell application "Mail"
repeat with msgRef in (get selection)
repeat with attachmentRef in mail attachments of msgRef
set attachmentName to name of attachmentRef
if offset of ":" in attachmentName is not 0 then
set text item delimiters to ":"
set attachmentName to text items of attachmentName
set text item delimiters to "-"
set attachmentName to attachmentName as text
end if
set filePath to (folderPath & name of attachmentRef) -- note:
assumes attachment name doesn't contain colons
save attachmentRef in filePath -- note: will raise an error if
file already exists
end repeat
end repeat
end tell
That makes it universal, and puts it on the desktop where I can see
it. and takes care of the possibility of colons in the name.
-- Michelle
--
Forget world peace.
Visualize using
your turn signal!
_______________________________________________
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/archives/applescript-users
This email sent to email@hidden