Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

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

Applescript 'not allowed to control Mac'

I'm currently on Snow Leopard but I'm running Mavericks on an external hard disk as a test. Most things seem to be working OK; but I have some complex automation set up using QuicKeys and Applescripts. I've given QuicKeys permission in System Preferences>Security to control the Mac, and all its shortcuts work OK; but where it hands off to an Applescript the process hangs with an error message saying the script is not allowed to control my Mac.


In the Security pane two 'Applets' appear (no further title) and I've allowed these permission; but still the same error and no apparent way of enabling the script.


I've set the General tab to allow any application to run, but I can't see any way of proceeding. Is there a way of getting this to work? - I have several vital pieces of automation which work fine on Snow Leopard and I will need them to work on Mavericks when I eventually get a new Mac.

24 inch iMac-OTHER, Mac OS X (10.6.8), 13 inch Macbook Pro (10.6.8)

Posted on Jun 6, 2014 2:34 AM

Reply
9 replies

Jun 6, 2014 4:32 AM in response to Barney-15E

I'll look into that, thanks. I may have found a solution here:


http://support.apple.com/kb/HT5914


and I'll implement that and see what happens. Any comments from anyone with hand-on experience of all this would be welcome. 'Just works', eh?


The irony is that this particular piece of automation was handled very largely in QuicKeys, but in anticipation of problems with that in later Systems I modified the process to do most of the work in ApleScripts. Now I find that QuicKeys seems to be OK and Apple's preventing me from using my own Applescripts unless I jump through various hoops.

Jun 6, 2014 5:51 AM in response to Roger Wilmut1

They aren't necessarily making you jump through hoops, that just wound up being a consequence of moving the security preference from global to per-application. As mentioned in the knowlegebase article, a regular AppleScript modifies itself by writing global variables and properties to the application file, which results in it being seen as a different program - one that hasn't been added to the security preferences.


You can also try making your application read-only, which will keep it from being changed, but note that if you are using properties to keep updated values between runs, they will also be prevented from being changed.

Jun 6, 2014 8:01 AM in response to red_menace

I don't think the particular script in question writes anything back - I'll check that - but I'll try the workaround they give. It did also occur to me that as QuicKeys can include an Applescript within a shortcut I could just copy the entire script back into QuicKeys (which as present does nothing but invoke it - it's just there to provide a keystroke trigger). The irritating thing is there are going to be quite a lot of scripts to do this sort of thing with.

Jun 6, 2014 10:16 AM in response to Roger Wilmut1

I checked, and yes it does write properties back. However it never got as far as completing even once. I'll look at the various options when I have time: but this is insane. I'm experienced, and can handle Terminal and Applescript, but someone who has written an Applescript which is now blocked, and has little experience in depth, would be lost. Security is one thing, but there's such a thing as going too far. I don't even want to upgrade to a Mac with Mavericks but I can't expect my current iMac - six years old now - to last for ever, and already Safari isn't working in a number of websites.

Jun 6, 2014 4:21 PM in response to Roger Wilmut1

AppleScript will also save global variables, which includes those in the run handler (including the implicit one), so this is a gotcha from way back before the current hoopla over sandboxing and security. If you aren't using properties to keep values from previous runs, the easiest would probably be to just make all of the application script files read-only, then you are done.

Jun 6, 2014 11:11 PM in response to red_menace

Unfortunately the script in question does write back data, as do many of my other scripts though at present I'm only testing this one. Annoyingly when you get the error and go to System Preferences it doesn't list the script by name, just says 'Applet'. The method described in the Apple Tech Note may be the answer (though it imples the script will run once, then not the second time, and it hasn't even run once so far) - I'll try this on Monday morning.

Jun 9, 2014 3:04 AM in response to Roger Wilmut1

I've now done extensive experimentation on this. The script in question runs until it gets to the point of using System Events to invoke menu commands in Nisus Writer Pro: this appear to be what is causing it to hang and throw up an error message that it is not allowed to control devices. It has been given permission in System Preferences>Security, and I have been through the Terminal process described at the bottom of this page:


http://support.apple.com/kb/HT5914


(they don't tell you that you have to install XCode). When repeating the process Terminal confirms that the script is signed. It does write back to itself at the end of its run, but it never gets as far as actually doing that.


Nothing I do will enable it to run. I've repeated the described process to no effect. Experimenting with a different script I got the same error, and couldn't get it to be recognized in System Preferences: the Terminal method had no effect.


The only way I was able to get the first script to run was to use QuicKeys, which has a facility for pasting in an AppleScript and running it within that - because QuicKeys has successfully been given permission the script runs OK.


This is outrageous. The script in question is an essential piece of automation I use regularly and have been doing so for years. Now even jumping through complex hoops that a less experienced user would be completely confused by won't enable it to run, other than by using a third party program which may eventually have its own problems.


Security is one thing but the system for allowing trusted scripts is completely broken.


I have attempted to send all this as feedback but the space allowed is too limited to enter all this text. I have asked them to contact me, though I have no idea whether this is likely.


As you may have detected I am extremely annoyed about all this and the time wasted (two hours today) trying to get it to work.

Applescript 'not allowed to control Mac'

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