October 22 2013 - 3:35 pm

OS X 10.9: AppleScripts and Accessibility Control

With OS X 10.9 Apple takes security more seriously than it ever has. In this regard, Apple has added an additional level of security for apps that access the Accessibility API via "System Events". Here's how that new level of security may affect the way you use some AppleScripts downloaded from this site.

First of all: Some of my script applets (the ones with user interfaces) cannot run effectively while iTunes is in full screen mode. This is because only one of them, iTunes or the script, can be frontmost. So, when these scripts are launched they will detect and alert you if iTunes is in full screen mode.

To do this the script targets "System Events" to check for an accessibility property of the iTunes user interface indicating whether or not full screen is on. "System Events" is in the purview of Accessibility. If you've ever used GUI Scripting—to script key codes for example—you've had to set "Enable access for assistive devices" in the Accessibility pane of System Preferences. Well, as of OS X 10.9, this is no longer a global setting and must be set on a per-app basis.

Thus, some scripts that actively target "System Events" while running on your installation of OS X 10.9 may oblige the Accessibility API to display a warning something like this:

The script doesn't actually want to "control your computer" in the ominous way this Accessibility alert is implying. It just wants to read an accessibility setting via "System Events". But the system's worst-case presumption is that any process that accesses "System Events" is going to be able to perform any number of Accessibility-related things (click buttons, select menu items, enter text, and so on) that may be malicious and which you won't be able to prevent.

You can click "Deny" and prevent the script from accessing the Accessibility API which will render the script's "System Events" routines useless. In fact, if you know you will never use the script while iTunes is in full screen mode you can click "Deny" here as well.

Or you can follow through to System Preferences and put a checkbox next to the name of the script in the "Security & Privacy" pane's "Privacy" tab:

Click the lock icon to make changes and enter your password when prompted. Once the setting is checkmarked the script won't ask again and it will run fine thereafter.

Of course, scripts and apps from other sources may have different accessibility requirements.

[UPDATE (November 8, 2014): I have slowly been dropping the use of System Events in my scripts so this will be less and less of an issue in the future.]

Site contents © 2001 - 2024 (that's right: 2001) Doug Adams and weblished by Doug Adams. Contact support AT dougscripts DOT com. About.
All rights reserved. Privacy.
AppleScript, iTunes, iPod, iPad, and iPhone are registered trademarks of Apple Inc. This site has no direct affiliation with Apple, Inc.
The one who says "it cannot be done" should not be interrupting the one who is doing it.