Re: Accessibility Error Message
Re: Accessibility Error Message
- Subject: Re: Accessibility Error Message
- From: Shane Stanley <email@hidden>
- Date: Fri, 06 Nov 2015 11:41:37 +1100
On 6 Nov 2015, at 11:01 AM, Jon Rosen <email@hidden> wrote:
>
> Some users (using Yosemite and El Capitan) are getting an error message saying that accessibility needs to be enabled when trying to run certain scripts. However, I made sure that the applications involved are checked in the Privacy/Accessibility pane in Security preferences. I’ve even added System Events, although I don’t think that is necessary. Where else would accessibility need to be enabled?
I suspect the problem you're seeing relates to the fact that every time you run a script, the actual file usually gets updated on disk. Because the code is modified, the system again asks the user to allow access. The solution is to stop the script file being modified each time.
If it's a .scpt file, you can do that like this:
set theScript to choose file of type {"scpt"}
do shell script "chmod a-w " & quoted form of (POSIX path of theScript)
If it's an applet, use this:
set thePath to choose file of type {"app"}
set thePath to (POSIX path of thePath) & "/Contents/Resources/Scripts/main.scpt"
do shell script "chmod a-w " & quoted form of thePath
But make sure you do it on a copy; you won't be able to edit the resulting script/app. And be aware that this means you can no longer rely on property values being persistent; you will need to store any values you want to persist yourself.
--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>
_______________________________________________
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