14. Notes
Rubygems issues
If using the appscript gem, don't forget to require 'rubygems'
before requiring appscript, otherwise the appscript gem won't load. For example:
begin
require 'rubygems'
rescue LoadError
end
require 'appscript'
...
Security issues
If including user names and/or passwords in remote application URLs, please note that appscript retains these URLs in both the Terminology
module's internal cache and in the Application and Reference objects subsequently created from those URLs. Security here is the user's responsibility, as it's their code that creates and retains these objects.
GUI Scripting
Non-scriptable applications may in some cases be controlled from Ruby by using System Events to manipulate their graphical user interface. Note that the "Enable access for assistive devices" checkbox must be selected in the Universal Access system preferences pane for GUI Scripting to work.
AEDescs
Some applications (e.g. QuarkXpress) may return values which appscript cannot convert to equivalent Ruby types. These values are usually of types which are defined, used and understood only by that particular application, and will be represented in Ruby as raw AE::AEDesc
objects (e.g. #<AE::AEDesc:0x33fc40>
). While there's not much you can do with raw AEDesc
objects within Ruby (it's best just to treat them as opaque types), subsequent commands can pass them back to the application for further use and/or conversion just like any other value.
Credits
Many thanks to Bill Birkett, Jordan Breeding, Fujimoto Hisakuni, Jordan K Hubbard, Alexander Kellett, Chris Nebel, Matt Neuburg, Laurent Sansonetti, Michelle Steiner, Kevin Van Vechten, and all the appscript users who've provided comments, criticisms and encouragement along the way.