• 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
Error saving mail attachment
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Error saving mail attachment


  • Subject: Error saving mail attachment
  • From: Neil Faiman <email@hidden>
  • Date: Sun, 26 Mar 2017 20:51:12 -0400

FWIW, this used to work; this is the first time I’ve tried it since upgrading to Sierra.

I have a script in ~/Library/ScriptsApplications/Mail, which I invoke from the Script menu in the menu bar while I have a message open in mail. The script begins by creating a temporary folder, finding all the attachments of the current message, and saving them with modified names in the folder:

tell application "Finder" to set tempFolder to (make new folder of alias minutesFolder)

set minutesFiles to saveMinutesToTempFolder(tempFolder)


. . .

to saveMinutesToTempFolder(tempFolder)
tell application "Mail"
. . .

-- Get the attachment(s) from the message


set tempFolderName to (tempFolder as string)
set minutesFiles to {}
try
set theAttachments to (get every mail attachment of theMessage)
on error
set theAttachments to {}
end try
repeat with anAttachment in theAttachments
try
if name of anAttachment ends with ".pdf" then
set fileName to name of anAttachment
tell zbaLib
set fileName to (changeSubstrings of fileName from ":" into "-")
set fileName to (changeSubstrings of fileName from "/" into "-")
end tell
set fileName to tempFolderName & fileName
display dialog fileName
save anAttachment in file fileName
tell application "Finder" to set end of minutesFiles to (file fileName)
end if
on error the error_message number the error_number
display dialog "Error saving attachment " & (name of anAttachment) & " to " & tempFolderName & ": " & the error_number & ". " & the error_message buttons {"OK"} default button 1
end try
end repeat

The first Display Dialog shows the fileName string for the save attachment command:

“Macintosh HD:Users:neil:Documents:ZBA:Minutes:untitled folder:03-21-17 Draft Minutes.pdf”. 

Then I get the error message:

“Error saving attachmemnt 03:21:17 Draft Minutes.pdf to Macintosh HD:Users:neil:Documents:ZBA:Minutes:untitled folder:: -10000. To view or change permissions, select the item in the Finder and choose File > Get Info.”

Has anyone else encountered this problem?

Thanks,

Neil Faiman
 _______________________________________________
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: Error saving mail attachment
      • From: Jean-Christophe Helary <email@hidden>
  • Prev by Date: Detect when an app is crashed
  • Next by Date: Re: Error saving mail attachment
  • Previous by thread: Safari Moving Focus to the URL List in Bookmarks and History Windows after a Search
  • Next by thread: Re: Error saving mail attachment
  • Index(es):
    • Date
    • Thread