• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Saving Attachements to a folder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: Saving Attachements to a folder
      • From: Doug McNutt <email@hidden>
References: 
 >Re: Saving Attachements to a folder (From: has <email@hidden>)

  • Prev by Date: Re: Saving Attachements to a folder
  • Next by Date: 3. Re: How to step through two lists at the same time? (Kurt Klamp)
  • Previous by thread: Re: Saving Attachements to a folder
  • Next by thread: Re: Saving Attachements to a folder
  • Index(es):
    • Date
    • Thread