Chapter 22. Unscriptable Applications
Some applications are not scriptable; they have no repertory of Apple events to which they are prepared to respond. The developers simply omitted this feature, like the tinsmith who forgot to give the Woodsman a heart. You try to open the application’s dictionary and you get an error. Other applications are scriptable, but they aren’t scriptable in the way you’d like; the thing you’d like to make the application do isn’t among its scriptable behaviors. In a case like this, how can you script the unscriptable?
On Mac OS 9 and before, the answer was to use a macro program . A macro program has the power to “see” an application’s interface and to act as a kind of ghost user, pressing buttons, typing keys, and choosing menu items. Anything a user can do in an application can presumably be performed through some definable sequence of mouse and keyboard gestures; therefore it might be possible to emulate that sequence of gestures with a macro program. The result might not be as fast, elegant, or flexible as using AppleScript, but it could get the job done; plus, a macro program might itself be scriptable. (Three very strong macro programs that I often used on earlier System versions were QuicKeys, PreFab Player, and OneClick; see http://www.cesoft.com/products/qkmac.html, http://www.prefab.com/player.html, and http://www.westcodesoft.com/index.html.)
In the past, macro programs depended upon a feature of the System architecture whereby third-party ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access