Skip navigation

Applescript on Mountain Lion not working

14882 Views 68 Replies Latest reply: Jul 30, 2013 2:30 AM by Nick Williams1 RSS
1 2 3 ... 5 Previous Next
nohairdave Calculating status...
Currently Being Moderated
Aug 7, 2012 3:29 PM

Ok, so I tried to run some applescripts from mail to do "clever" stuff based on rules.  Nothing.  No sign of life.  So, I tried a "Hello world" script, nothing happened either.

 

Looking at the console, I see the following reported by Mail:

 

07/08/2012 18:21:52.789 Mail[627]: Failed execution of AppleScript: /Users/.../Library/Application Scripts/com.apple.mail/test.scpt

Error Domain=NSCocoaErrorDomain Code=257 "The file “test.scpt” couldn’t be opened because you don’t have permission to view it." UserInfo=... {NSURL=file://localhost/Users/.../Library/Application%20Scripts/com.apple.mail/ test.scpt, NSLocalizedFailureReason=Script file is not in the application scripts folder.}

 

The script file is in ~Library/Application Scripts/com.apple.mail/

(which is where mail under Mountain Lion defaults me to save the applescript file)

 

Anyone else seeing this?  Or better still, how to solve it?

OS X Mountain Lion
  • baltwo Level 9 Level 9 (59,145 points)
    Currently Being Moderated
    Aug 7, 2012 3:30 PM (in response to nohairdave)

    Open the script with the AppleScript Editor, save it to the Desktop, quit ASE, and try running it from the Desktop. it that works, do the same for any other malfunctioning scripts. All the ones that ran in Lion run in ML; although I don't use an Mail ones.

    27" i7 iMac SL, Lion, OS X Mountain Lion, G4 450 MP w/Leopard, 9.2.2
  • Frank Caggiano Level 7 Level 7 (22,745 points)
    Currently Being Moderated
    Aug 7, 2012 7:10 PM (in response to nohairdave)

    Just tried copying the script Sample Rule Action Script.scpt which is an Apple supplied script to my ~/Library/Application Scripts/com.apple.mail and when the rule I created that had this script as its action fired the script ran OK.

     

    I would recommend you do the same and see if you can get this script to run. If this script runs there could be a problem with your scripts. If even this script fails then you might have a permissions issue with your Library folder.

     

    post back, regards

     

    Message was edited by: Frank Caggiano - I'm running ML BTW.

  • Frank Caggiano Level 7 Level 7 (22,745 points)
    Currently Being Moderated
    Aug 8, 2012 8:46 AM (in response to nohairdave)

    Well the usual next step in a situation like this would be to create a new user account, log in as that user and try the procedure out. If it works then you know the problem is in your user environment, if it fails then you're looking at a system wide problem.  Doesn't fix it but narrows down where  to look.

     

    In this case the new user step will be a bit of a pain because you'll need to setup a mail account of the test user. Even so I'd recommend doing this as it will  give you a more specific troubleshooting path to follow.

     

    It would seem that if you can copy the script (either the one you create of the Apple supplied default) to the ~/Library/Application Scripts/com.apple.mail folder the basic permissions would be OK.  The folder and script shouul be read/writable by you. Not sure just what would be the next step which is why I think it is important to see if a new user would be able to have the mail rule fire the script.

     

    good luck

    regards

  • jbauer Level 1 Level 1 (0 points)
    Currently Being Moderated
    Aug 9, 2012 12:32 PM (in response to nohairdave)

    I'm having the same kind of issue.  I'm also running ML, but not sure that's the root of the issue.

     

    This simple script WON'T WORK!

     

    set pathToSickBeard to "/Applications/Sick-Beard"

    do shell script "python " & pathToSickBeard & "/SickBeard.py > /dev/null 2>&1 &"

     

    I can enter the command in terminal, and it works PERFECTLY, but in AppleScript or running the app just fails.

     

    I've been banging my head against the wall trying to figure out why for about a week.

     

    Anyone?

     

    - Jon

  • cdnSpinalTap Level 1 Level 1 (0 points)
    Currently Being Moderated
    Aug 13, 2012 10:00 AM (in response to jbauer)

    Anybody having any luck, I am having the exact same problem.

     

    Thanks.

  • PeterVandewalle Calculating status...
    Currently Being Moderated
    Aug 17, 2012 8:35 AM (in response to cdnSpinalTap)

    I think it's linked to the safety restrictions Apple has built into ML.

    I have tried a script that activates a nn-running software (i.e. Textedit).

     

    activate application "TextEdit"

     

    It launches TextEdit but doesn't make it active.

    So I can't work the TextEdit file...

    Any ideas on how to force TextEdit to come forward?

  • Pierre L. Level 4 Level 4 (3,860 points)
    Currently Being Moderated
    Aug 17, 2012 11:31 AM (in response to PeterVandewalle)

    Any ideas on how to force TextEdit to come forward?

     

    tell application "TextEdit"

        launch

        activate

        make new document at front

    end tell

     

    or

     

    tell application "TextEdit"

        make new document at front

        activate

    end tell


    and so on… 

     

    Message was edited by: Pierre L.

  • PeterVandewalle Level 1 Level 1 (0 points)
    Currently Being Moderated
    Aug 18, 2012 3:47 PM (in response to nohairdave)

    I got it to there also. But the software I'm using doesn't understand the "launch" command...

     

    Any solutions?

  • Tony T1 Level 6 Level 6 (8,105 points)
    Currently Being Moderated
    Aug 30, 2012 5:54 AM (in response to PeterVandewalle)

    I'm also having this problem that started with ML.

    In Mail, the Rule will run with Message->Apply Rules, however, it will not work on incoming messages.

    The Console Error is:

     

    08/29/12 8:26:30.676 PM Mail[2958]: Failed execution of AppleScript: /Users/Tony/Library/Application Scripts/com.apple.mail/JunkFilter.scpt

    Error Domain=NSPOSIXErrorDomain Code=2 "The operation couldn’t be completed. /usr/bin/osascript: couldn't set default target: no eligible process with specified descriptor

    " UserInfo=0x7ffd1d8e0330 {NSURL=file://localhost/Users/Tony/Library/Application%20Scripts/com.apple.mail /JunkFilter.scpt, NSLocalizedFailureReason=/usr/bin/osascript: couldn't set default target: no eligible process with specified descriptor

    }

    MacBook Air, MacBook, Mac mini, OS X Mountain Lion (10.8.1)
  • Jacknumpty Level 1 Level 1 (0 points)
    Currently Being Moderated
    Sep 4, 2012 3:41 PM (in response to nohairdave)

    Hi after upgrading to Mountain Lion the applescript that I use to reply to certain emails has stoped working on incoming emails. I have the script in the "new" correct folder. The funny thing is that the script works when you "apply rules" from the messages dropdown menu.

  • baltwo Level 9 Level 9 (59,145 points)
    Currently Being Moderated
    Sep 4, 2012 4:29 PM (in response to Jacknumpty)

    File a bug report with Apple for lost functionality.

    27" i7 iMac SL, Lion, OS X Mountain Lion (10.8.1), G4 450 MP w/Leopard, 9.2.2
1 2 3 ... 5 Previous Next

Actions

More Like This

  • Retrieving data ...

Bookmarked By (1)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.