I created an application that uses system events to decide when to quit, but trying to use system events to check if another process is running or gives an error saying that the app is not allowed assistive access. After i gave it assistive access, however, it is still returning that error.
Which system are you running ?
Since Mavericks, the old instruction :
set (UI elements enabled) to true
can’t be used.
Triggering it issue :
error “Erreur dans System Events : Il est impossible de rÃ©gler UI elements enabled of application Ã true.” number -10006 from UI elements enabled of application
The feature is now ruled to a System Preference pane named in French « Security & Privacy » thru its tab named » Privacy ».
Yvan KOENIG running Yosemite 10.10.5 in French (VALLAURIS, France) samedi 26 septembre 2015 11:46:04
I had this problem in Yosemite with an AppleScript app that used System Events to activate menu items in Keynote. The system did not give it permission even after I told it to. In the end I had to save it as a script and run it through Script Editor for it to work. My guess is that the new security settings since Mavericks do not allow apps to access assistive services.
Once you give it access, you need to make sure the script file never changes – otherwise you have to give it access again. Because scripts generally save modified properties after each run, this is problematic; you need to do something like lock the script file, codesign the script, or change its permissions to make it execute only using ‘chmod a-w’ at the command line.
If your script use properties only to make variables usable by different handlers, here are two ways to get rid of that if you are able to edit your script:
(1) encapsulate the properties in a script object
property theDate : missing value set theDate to current date set theGrabbedDate to theDate
would be replaced by :
script o property theDate : missing value end script set o's theDate to current date set theGrabbedDate to o's theDate
(2) encapsulate all your script in a script object :
run germaine script germaine property theDate : missing value set theDate to current date set theGrabbedDate to theDate end script
Yvan KOENIG running Yosemite 10.10.5 in French (VALLAURIS, France) mardi 29 septembre 2015 20:51:45