Applescript error -10000

I have used, for a long time, an applescript I wrote to save out email attachments I get from students. The script gives the files new filenames so that I can tell which student the attachment is from, and so that another script I wrote for the finder can send the files back to the students after I've inserted my comments. After upgrading to Mountain Lion the script seems to be crapping out at the save step with an error number -10000. I can't seem to find any documentation on this error, and I have no idea what might have changed in applescript or OS X on Mountain Lion to cause this. Any ideas?
Here's my script:
set theOutputFolder to (choose folder) as string
tell application "Mail"
          set msgList to selection
          repeat with msg in msgList
                    set currentName to (sender of msg as rich text)
                    set theAttachments to every mail attachment of msg
                    repeat with a from 1 to length of theAttachments
                              set theAttachment to item a of theAttachments
                              set theAttachmentName to name of theAttachment as string
                              set AppleScript's text item delimiters to "."
                              set theAttachmentDelimit to the text items of theAttachmentName
                              set theAttachmentType to last item of theAttachmentDelimit
                              try
                                        set thefileName to currentName & a & "." & theAttachmentType
                                        set theSavePath to theOutputFolder & thefileName
  save theAttachment in theSavePath
                              end try
                    end repeat
          end repeat
end tell
And here's the relevant error (stripped of identifying information with ******):
save mail attachment id "3" of message id 85686 of mailbox "INBOX" of account "UAF" in "Steinitz:Users:*****:Dropbox:Courses:UAF:12Fall:631:HomeworkSolutions:HW1:***** ***** <*****@*****.edu>2.pdf"
  --> error number -10000

OK, I have a cludgy solution worked out, using a shell script to move the file from a location Applescript/Mail can save to, to the location I actually want the file to go. Here's the modified script that works.
set theOutputFolder to (choose folder) as string
tell application "Mail"
  activate
          set msgList to selection
          repeat with msg in msgList
                    set currentName to extract name from msg's sender
                    set theAttachments to every mail attachment of msg
                    repeat with a from 1 to length of theAttachments
                              set theAttachment to item a of theAttachments
                              set theAttachmentName to name of theAttachment as string
                              set AppleScript's text item delimiters to "."
                              set theAttachmentDelimit to the text items of theAttachmentName
                              set theAttachmentType to last item of theAttachmentDelimit
                              try
                                        set thefileName to currentName & a & "." & theAttachmentType
                                        set theSavePath to "drivename:Users:usename:Downloads:" & thefileName
  save theAttachment in theSavePath
                                        set posixSaved to quoted form of POSIX path of theSavePath
                                        set posixSaveto to POSIX path of theOutputFolder
                                        set posixSaveto to posixSaveto & thefileName
                                        set sscommand to "mv " & posixSaved & " " & quoted form of posixSaveto
  do shell script sscommand
                              end try
                    end repeat
          end repeat
end tell

Similar Messages

  • Applescript save fails with error -10000

    Hi,
    I'm trying to save email attachments in Applescript, but I get failures when I try to do so. Here's my little script:
    tell application "Mail"
              set theMessages to selection
              repeat with thisMessage in theMessages
                        set theAttachments to thisMessage's mail attachments
                        repeat with thisAttachment in theAttachments
                                  set theAttachmentFileName to "~/Desktop/temp/" & thisAttachment's name
      save thisAttachment's contents in theAttachmentFileName
                        end repeat
              end repeat
    end tell
    In the "Events" tab of the Applescript Editor, I see that the "save thisAttachment" line results in an error -10000:
      save mail attachment id "1" of message id 82265 of mailbox "INBOX" of account "Gmail" in "~/Desktop/temp/test.png"
      --> error number -10000
    Result:
    error "Mail got an error: AppleEvent handler failed." number -10000
    I can't help but think that I'm running into Lion's new sandboxing trick, and it doesn't allow me to save the attachment for some reason but it doesn't tell me what the reason is. I have tried some other mail saving Applescripts floating around on the net but they all seem to run into the same problem. I've repaired parmissions, re-configured mail and tried different attachments. Same error all the time.

    I had the same problem downloading an album - all files downloaded except one, giving the corrupted message. I saw another thread that said it worked if you disable the adware checker in your anti-virus/firewall. I use Kaspersky and disabled the anti-Banner setting - the problem file then downloaded. Strange it should only fail on one file however.

  • Automator Workflow returns Applescript Error.

    I recently created an automator workflow that will allow me to play an internet radio station without opening a browser. The workflow is…
    • Get Specified URL's (with the radio station's live streaming URL)
    • Website Popup (displays a window that plays the radio station)
    Simple enough. And it worked fine.
    So I thought, let's make this more useful. Let's add a second URL to the "Get Specified URL's" action, and options "Show this action when the workflow runs." Then I can select the radio station I want to listen to from the list.
    Now, when I run the workflow, I get the list of URL's to select from. When I click to select one, I get an "Applescript Error. AppleEvent Handler Failed -10000. That's the whole message. Nothing else.
    Now, this still works. When I click "OK" the workflow continues, brings up my popup window, and plays my radio station. But it's just an annoyance to have that AppleScript Error message pop up. Even more strange, (IMO) is that fact that if I leave both radio stations selected, there is no AppleScript Error, and my workflow defaults to the first radio station.
    BTW, the workflow is only these two automator actions. I did not add any Applescript of my own. And it's definitely the first action that's generating this message. It's the "click" that generates that message.
    Any ideas?

    Actually, I was referring to it's use in this case, since you are only going to select one item from the list - it isn't set up very well for selecting individual items. The resulting list should really be limited to one item, since allowing multiple selections might get interesting, but there isn't a handy way to do that. Using "Open URL" isn't a very good option either, since it leaves the workflow running.
    The error seems to be related to the checkboxes, so you might try an end run by using the *Choose from List* action, which doesn't have the problem:
    1) *Get Specified URLs* -- don't show the action when run
    2) *Choose from List* -- make the selection here
    3) *DIsplay Webpages*

  • Error 10000 keeps appearing

    I recently purchased 2 albums on Itunes store but whenever they attempt to download the message ''error 10000'' appears. I have tried several times to download them but its the ame story everytime.
    I had no problem downloading purchased music about a month ago.
    Any ideas would be much appreciated, it's driving me crazy!!

    Right off hand, I would say that the fact you have to restart the computer to recover is very odd indeed--and troubling. Have you tried to run any of the continuous acquisition examples that ship with LV to see if they exhibit the same behaviour? Also, is the computer on a network? If so, try unplugging it and see if you still get the problem. Finally, when the thing is slowing down, what does the computer's overall CPU utilization look like?
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Download of music keeps saying error 10000, song corrupted but I already had this song on my iphone.  Accidently took it off when i syncd new itunes onto my iphone and wiped out my iphone music organization etc.

    Hi community,
    I recently lost the computer i had my itunes on.  I also recently got an iphone. Everything was perfect and set up but then I had to create a new itunes account on my Dell desktop.  Anyway, when i created the account and connected my iphone i told me something about my iphone only having what was on my itunes on the computer.  I thought that was fine because all of my music is my purchases.  But i turns out that a whole chunk of my music wasn't there and my playlists got screwed up.  Playlists fine but I went to download the music and every single one of 33 songs says, Cannot download file corrupted, error 10000. Is this a problem with my computer?  These files were fine before i connected my iphone to this computer and itunes setup on it.   And I have them on my iphone but can't figure out how to move them from recently added to a playlist for running etc.  Thank you! 

    so i went ahead and did a restore from the new PC and then a restore from backup.  looks like that fixed everything... a few playlists were messed up and so far as i can tell, maybe just a few minor issues.

  • Trying to batch print to postscript and getting AppleScript Error!

    Here is the script as copied from Script Editor:
    -- make a variable for the print settings to use:
    set thPrintSettings to "Publishers PDF standard"
    global thPrintSettings
    -- initially, we'll allow for picking destinations at script start
    set targetFolder to choose folder with prompt "Location for PDF files..."
    global targetFolder
    set varBasename to "CTB"
    tell application "Adobe InDesign CS3"
    -- Environment test: We want 1 book, no documents open:
    try
    get document 1
    display dialog "Please run this script without any documents open (except one Book)" buttons "OK" default button 1
    return
    on error
    -- we must be good to go, no documents open
    end try
    try
    set thBook to book 1
    on error
    display dialog "Please open an InDesign Book to use this script" buttons "OK" default button 1
    end try
    if modified of thBook then
    display dialog "This Book has been modified. Do you want to continue running the script?" buttons {"Cancel", "Yes"} default button 1
    end if
    tell thBook
    set countOfThBook to (count of book contents)
    set thContentsList to (full name of book contents) as list
    end tell
    -- return {countOfThBook, thContentsList}
    set user interaction level of script preferences to never interact -- avoid any dialogs (for printing or saving)
    set n to 0
    repeat with j from 1 to countOfThBook -- loop through book's documents
    set thDoc to item j of thContentsList
    open thDoc
    tell active document
    repeat with c from 1 to (count of every ink)
    tell ink c
    set convert to process to true
    end tell
    end repeat
    set myName to varBasename
    repeat with i from 1 to count of pages -- loop through book's pages
    set y to name of page i
    set n to n + 1
    tell print preferences
    set page range to y --page range sets which page(s) to print
    set active printer preset to thPrintSettings
    set print file to alias ("" & targetFolder & myName & "_" & n & ".ps")
    end tell
    print --without print dialog
    end repeat
    close saving no
    end tell
    end repeat
    end tell
    Every time I try to run it I get the following error:
    AppleScript Error
    Adobe InDesign CS3 got an error: Invalid parameter.
    Help!!!

    On 2/12/08 1:52 AM, "Jaime C. Starkey" <[email protected]> wrote:<br /><br />> I replaced the "set active printer preset" line to "set thPrintSettings to<br />> printer preset "CTB"<br /><br />No -- you should leave the "set active printer preset to thPrintSettings"<br />line as it was. The line you need to change is "set thPrintSettings to<br />"Publishers PDF standard"" -- that's where you need to insert "printer<br />preset".<br /><br />-- <br />Shane Stanley <[email protected]><br />AppleScript Pro Florida, April 2009 <a href=http://scriptingmatters.com/aspro>

  • Appworld rejects payments error 10000

    Appworld 2.0 is happy to let me download free apps but rejects any attempt to buy paid for ones.  I get error 10000 and a comment that there is a problem with my credit card authorisation.  This happens with Paypal or with a credit card.  There is nothing wrong with either account.  In fact Appworld has done a test charge of £0.01 to verify my credit card.
    I have done a factory reset, re-loaded Appworld, changed Paypal accounts etc etc but still the same fault persists. 
    Paypal says it is nothing to do with them.  O2 in the UK will not accept that it is an issue for them.  I have spent an hour on the phone and online with Blackberry support and they uploaded a log file from my Blackberry.  I don't know what they will do with this.  They seem to be aware that there is an issue but ......
    Any ideas?
    Alan
    Blackberry 8520
    Carrier
    Carrier O2
    Blackberry 8520
    OS5
    Version of App World 2
    BIS

    Hey alanstewart,
    Welcome to the BlackBerry Support Community Forums.
    This is a known issue and our development team is currently investigating this issue.  For a work around you can try a different form of payment.
    For more information about this issue: www.blackberry.com/btsc/KB24454
    -ViciousFerret
    Come follow your BlackBerry Technical Team on Twitter! @BlackBerryHelp
    Be sure to click Like! for those who have helped you.
    Click  Accept as Solution for posts that have solved your issue(s)!

  • Applescript error 600

    I keep getting an Applescript error -600.........application isn't running.  When I click on "ok" Cocktail opens and runs pilot.  The script is then gone but eventually comes back.  Is there any way to stop this error from appearing?
    Thanks for helping.
    Ron

    That error was reported as a Cocktail error in pre- 6.3 versions. (See: fixed problems with a -600 error)
    Try uninstalling Cocktail to see if Cocktail is causing the error.

  • AppleScript error -609 in Automator workflow

    I created an AppleScript on one computer and incorporated it in an Automator workflow. The script works perfectly well stand-alone or as part of the workflow.
    Then I copied both files to a headless computer via VNC. I adjusted the workflow to look at the new location of the script, and the script itself to look at the new location of the file it's processing. Now, on that second computer, the script works perfectly well by itself, but I get AppleScript error -609 Connection Is Invalid if it's run from the workflow.
    For testing purposes I reduced the script to its simplest expression:
    tell application "Finder"
    end tell
    and it's still generating the error.
    Strangely, from the workflow the full script does what's it's supposed to, but the workflow stops because of the error. The error appears even if this script is alone in the workflow. Does anybody know what it means?

    That error means that the script wasn't able to communicate with the targeted application properly, which can happen if the application crashes while the script is running. If that error doesn't cause any problems, it's appearance can be suppressed:
    try
    (your code)
    on error number -609
    end try
    This construct will not execute any code on or after the line which produces the error.
    (32099)

  • Connecting with Bluetooth--AppleScript Error

    My current internet connection is through my mobile company here in Italy while studying abroad using the bluetooth of my phone. There's a program that I have to run from the company to connect, and the first few days after installing Leopard I was able to still connect, but with several glitches (i.e. locking up, my menu bar freezing in the connection, time, and power area showing the pinwheel when I hovered over it) and this caused me to have to force my laptop to shut down by holding the power button on several occasions.
    Now when I open the program, as it is loading the phone information and taking control of the network settings, I am greeted by a message saying, "The application FMM3MYIC quit unexpectedly." offering me to ignore, report, or relaunch. Both ignoring and relaunching lead to a second message saying (translated from Italian) "AppleScript Error: The localconnectionstatus variable is not defined. (-2753)" Ultimately this leads me without a connection.
    Any hints as to why it was running fine before and not now? I've recently installed the two latest updates thinking that might help and deleted the files as well as re-installed the program.
    I know nothing really about scripts, but would it be possible to edit the script for the program. Any help would be great--I went to a local Mac store (not an official one--just a support and sales place) here in Milan and they were really of no help. His suggestion was to run DiskUtility, which did me no good. Anyway thanks in advance.

    Could you verify a couple of things please?
    Are the 64-bit desktop and 32-bit laptop both paired to the same Nokia 5800, and are they used in such a way that both computers could be connected via Bluetooth to the 5800 at the same time? You should verify that the previous Bluetooth connection is turned off before using another. This can be done for example by disabling the bluetooth dongle from the other computer. It could be said that Ovi Suite doesn't support connecting to a mobile phone from multiple computers.
    Are you able to pair your Nokia 5800 with the Toshiba laptop at all? Or did I understand the problem correctly, that after restarting the Mobile device, it can be connected to the laptop? If it is a pairing problem, you could try pairing the device outside Ovi Suite by using the Microsoft Bluetooth stack directly.
    If the problem is not one of the above mentioned, and it persists, it could help if you post the following information to your reply (from Ovi Suite):
    Help->About->System Information->Copy text to clipboard

  • Appworld Error 10000 HELP!!!!!!

    Hello , I just tried to download an application from appworld cost $4.99 , I tried 4 times and 4 times i received this error code error 10000 There is a problem with your credit card authorization. Please try again or visit blackberry.com/appworld/support for more information. (Error ID: 10000)" My main issue is that I was charged the 4 times and the bank send me that my credit card has been used for a purchase the location is "DRI*app World" and it did not download the application , is there anyone I can speak to have a refund ? or atleast have the app downloaded              

    i have the same problem, i m in ecuador.

  • I am trying to load a calpatch to a program called Caldera, but i keep getting the following "AppleScript Error – Terminal got an error:apple event timed out ( -1712)" my IOS is Yosemite, and i am running the latest version of the caldera program

    I am trying to load a calpatch to a program called Caldera, but i keep getting the following “AppleScript Error – Terminal got an error:apple event timed out ( -1712)” my IOS is Yosemite, and i am running the latest version of the caldera program

    Hi Linc, thanks for this ... it is weird, we tried this previously, but we only did a restart.
    This morning our Mac was 'off' even though we hadn't turned it off, (maybe a power outage) I restarted and ran the calpatch immediately, and it worked !!
    it is embarrassing, because as a service engineer, I am always telling customers to restart and even power down completely before trying again.
    Thanks.
    Snakeydee

  • Error 10000 at invoke node

    There is an Error 10000 happened at invoke node in one of my subvi. Please see attached snapshot of the error message.
    This program(VI) has run for one month, and yesterday  this error happened first time.  After I stopped the VI, and ran it  again, there was no error anymore.
    Can anybody tell me possible causes?  Thanks.
    WT
    LV2013SP1
    Attachments:
    Invoke Node error at CallSubVI_Do.PNG ‏36 KB
    Call_Subvi_Do(variant).vi ‏20 KB

    weitong wrote:
    Thanks. But, I didn't get what you said.
    I am using "Call_Subvi_Do(variant).vi " to open and run another VI.  Which one I should check the state of by using the Property node "Execution>State>Idle",  "Call_Subvi_Do(variant).vi" OR the VI called by Call_Subvi_Do(variant).vi? By the way, the error is promted happening at the Invoke node in "Call_Subvi_Do(variant).vi" .
    Yes on the top its happens in the sub VI but when you debugg the sub VI you may find that error occuring at the onvoke node "Run VI". Check the attached VI with added check for the state of the VI.
    The best solution is the one you find it by yourself
    Attachments:
    Call_Subvi_Do(variant)_Anand.vi ‏21 KB

  • AppleScript Error when use with VisualHub

    Hi all,
    When i try to convert any movie with audio on VisualHub, then will show up these:
    sh: -c: line 1: unexpected EOF while looking for matching
    sh: -c: line 2: syntax error: unexpected end of file (2)
    Pls help or how can i fix it?
    Many Many Thanks
    morningpanda

    And your AppleScript code looks like ? ...
    **The Applescript error**
    **sh: -c: line 1: unexpected EOF while looking for matching**
    **sh: -c: line 2: syntax error: unexpected end of file (2)**
    And the format of the movie file (to be converted) is ? ...
    *quicktime to mp4*

  • Automator/Applescript error for Library selection - workarounds ?

    I am creating some Automator actions to simplfy my workflow, but do it in a way that suits me. eg.
    Step 1. Copy CF images to Time Capsule (easy)
    Step 2. Import CF images into Aperture doing the following:
    a. Import with option to create a new project (non-refd)
    b. Set ratings to 1.
    c. Set some IPTC data.
    d. Select some basic keywording
    Bang ! - import it all
    Seems and is reasonably easy, however two observations in the import to Aperture execution:
    - It runs very slowly (i might be able to live with this)
    - I often get an Applescript error and it seems linked to this old Apple doc asking me to add a 'Set Aperture Library" step in the Applescript ?! Huh ?
    http://docs.info.apple.com/article.html?artnum=307040
    Currently triggering both actions as Applications, but hope to sequentiall link them if i can get the solve for the error.
    Q1. Can i 'fix' this error within Automator actions ?
    Q2. Is it normal for the set rating and IPTC tagging to be glacial slow ?
    Getting more impressed with Automator power, but it sometimes seems to be a little flakey (perhaps or its me!)
    Appreciate any pointers...

    Scripts currently run v. slowly if you have a large library... submit a bug using the feedback form!

Maybe you are looking for

  • Photos do not appear in iMovie 11

    Suddenlhy photos imported into iMovie 11 do  not appear in iMovie anymore. Previously imported photos appear fine. I am using OSX Mountain Lion. Any idea what is wrong ?

  • Memory usage exceed -Xmx option in Windows 2000.

    Hi , I run the java application with -Xms300M -Xmx600M option in Windows 2000. When I start the application, it's virtual memory size is 300M. (In Windows TaskManager choose the Processes Tab and select "Select Columns..." option in View menu. And ch

  • OfficeJet 8600- MAC 10.8- Selecting:Scan to Computer-get Error Message: HP Utility quit unexpectedly

    -On a Mac Air - (10.8.5) -Installed the software for the HP OfficeJet Pro 8600 Plus.   -Installed full software (not minimum or recommended). -Connected by ethernet cable to network. -Setup to Email was successful -Every time I select the "Scan to Co

  • OAAttrValException error

    I'm adding validation for my dimensions and one of the requirements is that the value must be > 0. Therefore, I'm rasing an exception if length,width, or height = 0. I'm using OAAttrValException to prompt user that 0 is unacceptable. I've define the

  • Cannot make procedure in DB based on view

    hi Experts, I created a view vw1 in schema abc,I can easly query the veiw but when I try to include SELECT col1,col2 from vw1; in Stored Procedure... SQL*PLUS shows me procedure created with compliation erros By enter show error its shows me view or