Your search query "linkto%3A%22MacPython%2FAppleScript%22" didn't return any results. Please change some terms and refer to HelpOnSearching for more information.
(!) Consider performing a full-text search with your search terms.

Clear message

What is AppleScript?

AppleScript is a scripting language developed by Apple, included as standard in Mac OS (System 7 Pro and later) and Mac OS X. It has two important technical features:

Equivalent Python Features

Python provides extensive third-party application scripting support and limited OSA language component support. It also supports AppleEvent handling and can load and use other OSA language components.

Application scripting

Python has long supported sending AppleEvents via the high-level aetools and gensuitemodule modules in its standard library. However, these modules have always had a number of shortcomings and have grown increasingly troublesome in recent Mac OS X releases; in particular, they are completely broken on Intel-based Macs. As a result, these and other AE/OSA-related modules will be removed in a future Python release and their use should be avoided.

There is also a low-level extension, Carbon.AE, that can be used to construct and send AppleEvents. Using this API requires detailed knowledge of the Apple Event Manager, however, and is rarely used directly.

A modern replacement to aetools and gensuitemodule, the ../AppscriptModule, has been available since late 2003. (A second project, aeve, has since been discontinued.)

Python OSA language components

There have been several attempts to develop a Python OSA language component, though to date none of them provide a complete replacement for AppleScript.

Apple event handling

The Python standard library has long provided a basic AppleEvent handing framework, MiniAEFrame, but as with aetools and gensuitemodule this module is unsupported on Intel Macs and will be removed in future, and its use should be avoided.

The low-level Carbon.AE extension can be used to install Apple event handlers, though lacks the ability to install coercion handlers and requires detailed knowledge of the ../AppleEventManager to use, so is rarely used directly.

There are two modern, high-level options for implementing AppleEvent handling in Python-based applications:

OSA API access

There are currently two ways to access the OSA API in Python:

See also

Unable to edit the page? See the FrontPage for instructions.