Differences between revisions 6 and 7
Revision 6 as of 2007-05-25 21:50:12
Size: 2576
Editor: 218
Comment: vvajcomsn.com
Revision 7 as of 2007-05-25 22:22:50
Size: 4464
Editor: DavidBoddie
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
<a href='http://dietrinepatchcom.elan123.dtdns.net'>dietrinepatchcom</a> <br />
<a href='http://dietrinepatch-com.elan123.dtdns.net'>dietrinepatch com</a> <br />
<a href='http://wwwdietrinepatchcom.elan123.dtdns.net'>wwwdietrinepatchcom</a> <br />
<a href='http://www-dietrinepatch-com.elan123.dtdns.net'>www dietrinepatch com</a> <br />
<a href='http://wwwdietrinepatch.elan123.dtdns.net'>wwwdietrinepatch</a> <br />
<a href='http://www-dietrinepatch.elan123.dtdns.net'>www dietrinepatch</a> <br />
<a href='http://hoodiabalance.elan123.dtdns.net'>hoodiabalance</a> <br />
<a href='http://hoodiabalancecom.elan123.dtdns.net'>hoodiabalancecom</a> <br />
<a href='http://hoodiabalance-com.elan123.dtdns.net'>hoodiabalance com</a> <br />
<a href='http://wwwhoodiabalancecom.elan123.dtdns.net'>wwwhoodiabalancecom</a> <br />
<a href='http://www-hoodiabalance-com.elan123.dtdns.net'>www hoodiabalance com</a> <br />
<a href='http://wwwhoodiabalance.elan123.dtdns.net'>wwwhoodiabalance</a> <br />
<a href='http://www-hoodiabalance.elan123.dtdns.net'>www hoodiabalance</a> <br />
<a href='http://hoodiachaser.elan123.dtdns.net'>hoodiachaser</a> <br />
<a href='http://hoodiachasercom.elan123.dtdns.net'>hoodiachasercom</a> <br />
<a href='http://hoodiachaser-com.elan123.dtdns.net'>hoodiachaser com</a> <br />
<a href='http://wwwhoodiachasercom.elan123.dtdns.net'>wwwhoodiachasercom</a> <br />
<a href='http://www-hoodiachaser-com.elan123.dtdns.net'>www hoodiachaser com</a> <br />
<a href='http://wwwhoodiachaser.elan123.dtdns.net'>wwwhoodiachaser</a> <br />
<a href='http://www-hoodiachaser.elan123.dtdns.net'>www hoodiachaser</a> <br />
<a href='http://hoodiadietreview.elan123.dtdns.net'>hoodiadietreview</a> <br />
<a href='http://hoodiadietreviewcom.elan123.dtdns.net'>hoodiadietreviewcom</a> <br />
<a href='http://hoodiadietreview-com.elan123.dtdns.net'>hoodiadietreview com</a> <br />
<a href='http://wwwhoodiadietreviewcom.elan123.dtdns.net'>wwwhoodiadietreviewcom</a> <br />
<a href='http://www-hoodiadietreview-com.elan123.dtdns.net'>www hoodiadietreview com</a> <br />
<a href='http://wwwhoodiadietreview.elan123.dtdns.net'>wwwhoodiadietreview</a> <br />
<a href='http://www-hoodiadietreview.elan123.dtdns.net'>www hoodiadietreview</a> <br />
<a href='http://hoodiagordoniiplus.elan123.dtdns.net'>hoodiagordoniiplus</a> <br />
<a href='http://hoodiagordoniipluscom.elan123.dtdns.net'>hoodiagordoniipluscom</a> <br />
<a href='http://hoodiagordoniiplus-com.elan123.dtdns.net'>hoodiagordoniiplus com</a> <br />
= 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:
 
 * It can communicate with local and remote processes via ../AppleEvents; commonly known as "application scripting".
 
 * It is an ["../OSA"] language component, allowing client applications to load and run scripts via the language agnostic OSA API. Client applications can use the OSA API to implement features such as Folder Actions (System Events), Mail rules, iCal alarm scripts, OSA script editing (Script Editor, Script Debugger), etc.
 
= 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, so 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.
 
 * OSAPython implements much of the OSA interface, but is unfinished and is no longer being developed.
 
 * MacPythonOSA is another attempt to implement the full OSA interface, but is also unfinished and currently inactive.
 
 * PythonOSA provides a working implementation of the core OSA interface, allowing OSA scripts written in Python to be loaded, stored, compiled and executed. More advanced OSA features, such as the ability to send and receive !AppleEvents to and from the host process are not currently available.
 
== 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:
 
 * aemreceive (bundled with the !AppscriptModule) can be used to install !AppleEvent handlers although it provides no assistance for resolving object references so is best suited for use in applications that don't implement an ../AppleEventObjectModel.
 
 * PyObjC-based applications can leverage the /AppKit framework's built-in Cocoa Scripting support to implement a full !AppleEventObjectModel.
 
== OSA API access ==
 
There are currently two ways to access the OSA API in Python:
 
 * The {{{CarbonX.OSA}}} extension (bundled with the !AppscriptModule) provides a low-level wrapper around the OSA API. (There is also a {{{Carbon.OSA}}} extension included in Python 2.4 and later, but it provides only a partial implementation and contains several bugs so is best avoided.) A high-level wrapper for {{{CarbonX.OSA}}} is under development.
 
 * PyObjC includes a wrapper for the (currently undocumented) {{{OSAKit}}} API on OS 10.4 and later.
 
= See also =
 
 * ["../aeve"]
 * ../AppscriptModule
 * ../AppleEvents
 * ../AppleScriptNotes
 * ../FourCharacterCode
 * ["../OSA"]
 * http://wilbur.acm.uiuc.edu/afs/sig/macwarriors/www/applescript/
 * http://www.cs.utexas.edu/users/wcook/papers/AppleScript/AppleScript95.pdf
 * http://developer.apple.com/technotes/tn2002/tn2106.html

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:

  • It can communicate with local and remote processes via ../AppleEvents; commonly known as "application scripting".

  • It is an ["../OSA"] language component, allowing client applications to load and run scripts via the language agnostic OSA API. Client applications can use the OSA API to implement features such as Folder Actions (System Events), Mail rules, iCal alarm scripts, OSA script editing (Script Editor, Script Debugger), etc.

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, so 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.

  • OSAPython implements much of the OSA interface, but is unfinished and is no longer being developed.
  • MacPythonOSA is another attempt to implement the full OSA interface, but is also unfinished and currently inactive.
  • PythonOSA provides a working implementation of the core OSA interface, allowing OSA scripts written in Python to be loaded, stored, compiled and executed. More advanced OSA features, such as the ability to send and receive AppleEvents to and from the host process are not currently available.

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:

  • aemreceive (bundled with the AppscriptModule) can be used to install AppleEvent handlers although it provides no assistance for resolving object references so is best suited for use in applications that don't implement an ../AppleEventObjectModel.

  • PyObjC-based applications can leverage the /AppKit framework's built-in Cocoa Scripting support to implement a full AppleEventObjectModel.

OSA API access

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

  • The CarbonX.OSA extension (bundled with the AppscriptModule) provides a low-level wrapper around the OSA API. (There is also a Carbon.OSA extension included in Python 2.4 and later, but it provides only a partial implementation and contains several bugs so is best avoided.) A high-level wrapper for CarbonX.OSA is under development.

  • PyObjC includes a wrapper for the (currently undocumented) OSAKit API on OS 10.4 and later.

See also

MacPython/AppleScript (last edited 2011-03-08 10:14:53 by 82)

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