2 :mod:`aetypes` --- AppleEvent objects
3 =====================================
7 :synopsis: Python representation of the Apple Event Object Model.
8 .. sectionauthor:: Vincent Marchetti <vincem@en.com>
9 .. moduleauthor:: Jack Jansen
11 The :mod:`aetypes` defines classes used to represent Apple Event data
12 descriptors and Apple Event object specifiers.
14 Apple Event data is contained in descriptors, and these descriptors are typed.
15 For many descriptors the Python representation is simply the corresponding
16 Python type: ``typeText`` in OSA is a Python string, ``typeFloat`` is a float,
17 etc. For OSA types that have no direct Python counterpart this module declares
18 classes. Packing and unpacking instances of these classes is handled
19 automatically by :mod:`aepack`.
21 An object specifier is essentially an address of an object implemented in a
22 Apple Event server. An Apple Event specifier is used as the direct object for an
23 Apple Event or as the argument of an optional parameter. The :mod:`aetypes`
24 module contains the base classes for OSA classes and properties, which are used
25 by the packages generated by :mod:`gensuitemodule` to populate the classes and
26 properties in a given suite.
28 For reasons of backward compatibility, and for cases where you need to script an
29 application for which you have not generated the stub package this module also
30 contains object specifiers for a number of common OSA classes such as
31 ``Document``, ``Window``, ``Character``, etc.
33 The :mod:`AEObjects` module defines the following classes to represent Apple
34 Event descriptor data:
37 .. class:: Unknown(type, data)
39 The representation of OSA descriptor data for which the :mod:`aepack` and
40 :mod:`aetypes` modules have no support, i.e. anything that is not represented by
41 the other classes here and that is not equivalent to a simple Python value.
46 An enumeration value with the given 4-character string value.
49 .. class:: InsertionLoc(of, pos)
51 Position ``pos`` in object ``of``.
54 .. class:: Boolean(bool)
59 .. class:: StyledText(style, text)
61 Text with style information (font, face, etc) included.
64 .. class:: AEText(script, style, text)
66 Text with script system and style information included.
69 .. class:: IntlText(script, language, text)
71 Text with script system and language information included.
74 .. class:: IntlWritingCode(script, language)
76 Script system and language information.
79 .. class:: QDPoint(v, h)
84 .. class:: QDRectangle(v0, h0, v1, h1)
86 A quickdraw rectangle.
89 .. class:: RGBColor(r, g, b)
96 An OSA type value with the given 4-character name.
99 .. class:: Keyword(name)
101 An OSA keyword with the given 4-character name.
104 .. class:: Range(start, stop)
109 .. class:: Ordinal(abso)
111 Non-numeric absolute positions, such as ``"firs"``, first, or ``"midd"``,
115 .. class:: Logical(logc, term)
117 The logical expression of applying operator ``logc`` to ``term``.
120 .. class:: Comparison(obj1, relo, obj2)
122 The comparison ``relo`` of ``obj1`` to ``obj2``.
124 The following classes are used as base classes by the generated stub packages to
125 represent AppleScript classes and properties in Python:
128 .. class:: ComponentItem(which[, fr])
130 Abstract baseclass for an OSA class. The subclass should set the class attribute
131 ``want`` to the 4-character OSA class code. Instances of subclasses of this
132 class are equivalent to AppleScript Object Specifiers. Upon instantiation you
133 should pass a selector in ``which``, and optionally a parent object in ``fr``.
136 .. class:: NProperty(fr)
138 Abstract baseclass for an OSA property. The subclass should set the class
139 attributes ``want`` and ``which`` to designate which property we are talking
140 about. Instances of subclasses of this class are Object Specifiers.
143 .. class:: ObjectSpecifier(want, form, seld[, fr])
145 Base class of ``ComponentItem`` and ``NProperty``, a general OSA Object
146 Specifier. See the Apple Open Scripting Architecture documentation for the
147 parameters. Note that this class is not abstract.