py-osax manual | 1. Introduction

#

## 1. Introduction

The `osax` module is deprecated and its use is not recommended.

The `osax` module provides an easy way to call macOS's Standard Additions scripting addition from Python. It exports a single public class, `OSAX`. For convenience, it also re-exports appscript's `ApplicationNotFoundError` and `CommandError` classes and `k` variable.

An `OSAX` instance represents a running process into which the Standard Additions scripting addition has been automatically loaded. It is similar to an appscript application object, except that it defines commands for Standard Additions instead of the application's normal commands.

Once you've created a `OSAX` instance, you can invoke its commands in exactly the same way as you would call a scriptable application's commands in appscript.

For example:

    import osax

    sa = osax.OSAX()

    sa.say("Hello world", using="Victoria")

The default application commands (`run`, `activate`, `quit`, etc.) are also available; see the appscript manual for details on those.

By default, `OSAX` objects are targeted at the current application. You can specify another application by supplying one of the following optional keyword arguments: `name`, `id`, or `url`. These arguments are the same as for appscript.