Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Applescript on Mountain Lion not working

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

Posted on Aug 7, 2012 9:36 AM

Reply
68 replies

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.

Aug 8, 2012 3:47 AM in response to baltwo

I dont think its just related to mail rule scripts - tried a few and am getting mixed results.


I tried running the script from the desktop - just keep popping up the editor. No matter how I try to run it.


I've also noticed that I cant record any actions, either. No "interesting" console messages either.


Trying to run the demo Sample Rule Action Script from its default location, also throws the following console messages:


08/08/2012 12:43:27.393 AppleScript Runner[6101]: CPSGetFrontProcess(): This call is deprecated and should not be called anymore.

08/08/2012 12:43:28.168 com.apple.launchd.peruser.501[349]: ([0x0-0x4ff4ff].com.apple.inputmethod.ironwood[6094]) Exited: Killed: 9

08/08/2012 12:43:28.000 kernel[0]: memorystatus_thread: idle exiting pid 6094 [DictationIM]


I'm stumped.

Aug 8, 2012 3:52 AM in response to Frank Caggiano

Frank, thanks for your reply.


Yep, tried all that - even did a desperate display dialog "Hello" as a test - this worked outside of mail, but not under the mail library. Thats the most "success" I've had.


Definately thinking permissions or other ML side-effect, but cant be sure.


Do know how I can check the permissions on the library / script folder / script itself? I've already tried doing a repair permissions via disk utility / onyx as a precaution

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

Aug 9, 2012 6:31 AM in response to Frank Caggiano

Frank


Tried that today - no luck.


Applescript editor can't record any actions. Any "complex" script doesnt seem to work directly in applescript, mail rules dont appear to trigger


I guess there must be something fundamentally wrong with my installation - as looking around the forums there's a lot of other users saying scripting / recording is working for them. That said, I have a second machine (an upgraded iMac) with the same problem.


When I get a chance, I'll try a fresh install, or try this on a non-ML mac. Perhaps that will solve the problem or give me a clue to the problem.

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

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

}

Applescript on Mountain Lion not working

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.