API Notes: ScriptingBridge framework


An introduction to PyObjC describes the general method for translating Objective-C calls into Python calls, including the handling of pass-by-reference arguments and buffers.

This document describes where the PyObjC bindings for this framework are different from the general rule, such as mentioning APIs that are not supported or where the interface is different than expected.

Basic usage

The Objective-C documentation for the scripting bridge frameworks focusses on static tools for creating proxy classes for scriptable applications. This is in general not needed when you’re programming in Python.

In Python you can just as easy create a dynamic proxy object:

iTunes = SBApplication.applicationWithBundleIdentifier_("com.apple.iTunes")

This can then be used to call “AppleScript” methods, like this:

print iTunes.currentTrack().name()

API Notes

-[SBObject sendEvent:id:parameters]

This method is not supported at the moment.