I'm playing with the F-Script object browser to explore the scripting capabilities of various applications on my system. Starting with the SBApplication class, I can connect to an application, visualize its scripting interface as regular methods and manipulate it interactively just like a regular object. This is using the Scripting Bridge, the Cocoa/AppleScript bridge provided by Apple in Leopard (see Fun with Leopard's Scripting Bridge – Part 1).
- Download and build F-Script 2.0 alpha: FScriptSources-2_0_alpha.zip
- Launch F-Script.app
- In the object browser, click on the Classes button. This lists all the classes currently linked.
- In the class list, click on the
SBApplicationclass. This displays the methods of the class object.
- In the method list, click on the
applicationWithBundleIdentifier:method and provide the required argument (i.e., a string containing the identifier of the application you want to connect to); for example, enter
- You can now use the object browser to explore and experiment the scripting interface of the application.
As shown in the screenshot, the browser displays the methods of the Cocoa object automatically created by the Scripting Bridge to represent the iTunes application. To invoke a particular method, all you have to do is to click on it (the browser will asks you for arguments if needed). Once the method returns, the result is displayed in a new column in the browser and you can further explore and manipulate it. The object browser provides a lot of features to help exploring and navigating objects. You'll find a detailed description in: Exploring Cocoa with F-Script.