SBApplication class provides a mechanism enabling an Objective-C program to send Apple events to a scriptable application and receive Apple events in response. It thereby makes it possible for that program to control the application and exchange data with it. Scripting Bridge works by bridging data types between Apple event descriptors and Cocoa objects.
- macOS 10.5+
SBApplication includes methods that manually send and process Apple events, you should never have to call these methods directly. Instead, subclasses of
SBApplication implement application-specific methods that handle the sending of Apple events automatically.
For example, if you wanted to get the current iTunes track, you can simply use the
current method of the dynamically defined subclass for the iTunes application—which handles the details of sending the Apple event for you—rather than figuring out the more complicated, low-level alternative:
If you do need to send Apple events manually, consider using the
You rarely instantiate
SBApplication objects directly. Instead, you get the shared instance of a application-specific subclass typically by calling one of the
application class methods, using a bundle identifier, process identifier, or URL to identify the application.