rb-appscript 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +30 -0
- data/LICENSE +1 -1
- data/README +7 -3
- data/TODO +7 -1
- data/doc/aem-manual/01_introduction.html +23 -9
- data/doc/aem-manual/02_apioverview.html +25 -11
- data/doc/aem-manual/03_packingandunpackingdata.html +22 -17
- data/doc/aem-manual/04_references.html +49 -36
- data/doc/aem-manual/05_targettingapplications.html +25 -14
- data/doc/aem-manual/06_buildingandsendingevents.html +47 -21
- data/doc/aem-manual/07_findapp.html +22 -11
- data/doc/aem-manual/08_examples.html +21 -10
- data/doc/aem-manual/index.html +28 -12
- data/doc/appscript-manual/01_introduction.html +40 -27
- data/doc/appscript-manual/02_aboutappscripting.html +28 -15
- data/doc/appscript-manual/03_quicktutorial.html +29 -16
- data/doc/appscript-manual/04_gettinghelp.html +31 -16
- data/doc/appscript-manual/05_keywordconversion.html +23 -10
- data/doc/appscript-manual/06_classesandenums.html +32 -19
- data/doc/appscript-manual/07_applicationobjects.html +31 -18
- data/doc/appscript-manual/08_realvsgenericreferences.html +23 -11
- data/doc/appscript-manual/09_referenceforms.html +33 -20
- data/doc/appscript-manual/10_referenceexamples.html +30 -17
- data/doc/appscript-manual/11_applicationcommands.html +25 -13
- data/doc/appscript-manual/12_commandexamples.html +26 -15
- data/doc/appscript-manual/13_performanceissues.html +46 -20
- data/doc/appscript-manual/14_notes.html +29 -19
- data/doc/appscript-manual/index.html +27 -11
- data/doc/full.css +95 -9
- data/doc/index.html +27 -10
- data/doc/mactypes-manual/01_introduction.html +56 -0
- data/doc/mactypes-manual/02_aliasclass.html +134 -0
- data/doc/mactypes-manual/03_fileurlclass.html +136 -0
- data/doc/mactypes-manual/04_unitsclass.html +102 -0
- data/doc/mactypes-manual/index.html +26 -227
- data/doc/osax-manual/01_introduction.html +69 -0
- data/doc/osax-manual/02_interface.html +149 -0
- data/doc/osax-manual/03_examples.html +75 -0
- data/doc/osax-manual/04_notes.html +80 -0
- data/doc/osax-manual/index.html +26 -195
- data/doc/rb-appscript-logo.png +0 -0
- data/rb-appscript.gemspec +2 -2
- data/sample/TextEdit_demo.rb +1 -1
- data/src/lib/_aem/aemreference.rb +1 -1
- data/src/lib/_aem/codecs.rb +42 -8
- data/src/lib/_aem/connect.rb +3 -1
- data/src/lib/_aem/findapp.rb +1 -1
- data/src/lib/_aem/mactypes.rb +1 -1
- data/src/lib/_aem/send.rb +162 -142
- data/src/lib/_aem/typewrappers.rb +2 -2
- data/src/lib/_appscript/defaultterminology.rb +76 -46
- data/src/lib/_appscript/referencerenderer.rb +1 -1
- data/src/lib/_appscript/reservedkeywords.rb +2 -2
- data/src/lib/_appscript/safeobject.rb +1 -1
- data/src/lib/_appscript/terminology.rb +30 -19
- data/src/lib/aem.rb +1 -6
- data/src/lib/appscript.rb +65 -20
- data/src/lib/osax.rb +21 -18
- data/src/rbae.c +1 -1
- data/test/test_appscriptcommands.rb +1 -1
- metadata +12 -3
data/CHANGES
CHANGED
@@ -1,3 +1,33 @@
|
|
1
|
+
2009-07-05 -- 0.5.2
|
2
|
+
|
3
|
+
- removed deprecated AEM::Application.is_running? method
|
4
|
+
|
5
|
+
- added #dont_cache_unpacked_specifiers, #pack_strings_as_type compatibility options to AEM::Codecs
|
6
|
+
|
7
|
+
- added default definitions for 'item' type, 'items' elements, 'properties' property as Apple have removed the 'item' class definition from skeleton.sdef (the default terminology for Cocoa apps)
|
8
|
+
|
9
|
+
- property and elements methods now raise ArgumentError if passed arguments; previously, malformed elements selectors, e.g. app('TextEdit').documents(1).text, would be silently ignored, resulting in unexpected behaviour
|
10
|
+
|
11
|
+
- Codecs#unpack now tries to coerce descriptors of typeVersion to unicode text (works on 10.4+) c.f. AppleScript (note: itunes.version.get returns the wrong version number otherwise; this appears to be an iTunes bug, but is masked by current AppleScript behaviour)
|
12
|
+
|
13
|
+
- #process_exists_for_url?, #remote_app in connect.rb now raise error if URL string doesn't contain a colon (process will crash otherwise due to an OS bug)
|
14
|
+
|
15
|
+
- improved error reporting in Reference#[] when a malformed generic reference containing a command expands to a non-reference value. e.g. its.name.get() would previously expand the the value of the object's 'name' property, typically a string, resulting in a cryptic NoMethodError; this now raises a descriptive ArgumentError.
|
16
|
+
|
17
|
+
- fixed bug where Terminology module would error on zero-length keywords in problem dictionaries (e.g. MS Word 12.1.7)
|
18
|
+
|
19
|
+
- AEM::Codecs now correctly unpacks AEDescs of typeBoolean whose data >1 byte
|
20
|
+
|
21
|
+
- fixed inconsistent escaping of application-defined property/element names that overlap built-in type/enum/property names but uses different codes. e.g. Adobe Illustrator defines 'rotation' as 'SxRx' - this overlaps built-in definition ('rotation' = 'trot'), so is escaped as 'rotation_'. Previously only the Keyword was escaped (i.e. :rotation_ but ref.rotation) now both are escaped (i.e. :rotation_, ref.rotation_). Users should update existing code as needed.
|
22
|
+
|
23
|
+
- restructured defaultterminology.rb to make it easier to maintain
|
24
|
+
|
25
|
+
- changed default terminology mapping for :data from KAE::CRawData ('rdat') to KAE::TypeData ('tdta')
|
26
|
+
|
27
|
+
- the OSAX module now obtains list of installed scripting additions on first use instead of import (the .osax scanning code uses System Events via AEM, and sending Apple events in event loop-based application before the event loop is started can disrupt the process's handling of incoming Apple events)
|
28
|
+
|
29
|
+
|
30
|
+
|
1
31
|
2008-02-18 -- 0.5.1
|
2
32
|
|
3
33
|
- fixed bug in Appscript::Application#launch where calling it on an application specified by_pid/by_url/by_aem_app would raise error -1708
|
data/LICENSE
CHANGED
@@ -7,7 +7,7 @@ All code is released under the MIT License, except for the following:
|
|
7
7
|
======================================================================
|
8
8
|
MIT LICENSE
|
9
9
|
|
10
|
-
Copyright (C) 2006-
|
10
|
+
Copyright (C) 2006-2009 HAS
|
11
11
|
|
12
12
|
======================================================================
|
13
13
|
THE RUBY LICENSE
|
data/README
CHANGED
@@ -27,13 +27,17 @@ Please note that the version of Ruby included with Mac OS X 10.4 (Tiger) is miss
|
|
27
27
|
======================================================================
|
28
28
|
NOTES
|
29
29
|
|
30
|
+
- Developer tools for exporting application dictionaries (ASDictionary) and converting application commands from AppleScript to appscript syntax (ASTranslate) are available separately:
|
31
|
+
|
32
|
+
http://appscript.sourceforge.net/tools.html
|
33
|
+
|
30
34
|
- This is a beta release. Please file bug reports if you encounter any problems.
|
31
35
|
|
32
|
-
- rb-appscript 0.5.
|
36
|
+
- rb-appscript 0.5.2 contains bug and compatibility fixes; see the CHANGES file and documentation for details.
|
33
37
|
|
34
38
|
- rb-appscript currently provides 64-bit support for OS X 10.5 in the following modules: AE, AEM, Appscript. The OSAX module provides partial 64-bit support; see the osax manual for details.
|
35
39
|
|
36
|
-
- ASDictionary 0.
|
40
|
+
- ASDictionary 0.11.3 or later is required to use rb-appscript's built-in #help method. If ASDictionary isn't installed, interactive help won't be available but appscript will continue to operate as normal.
|
37
41
|
|
38
42
|
|
39
43
|
======================================================================
|
@@ -44,6 +48,6 @@ AUTHOR
|
|
44
48
|
======================================================================
|
45
49
|
COPYRIGHT
|
46
50
|
|
47
|
-
Copyright (C) 2006-
|
51
|
+
Copyright (C) 2006-2009 HAS
|
48
52
|
|
49
53
|
Appscript is released under the MIT License. See the LICENSE file for more information.
|
data/TODO
CHANGED
@@ -10,4 +10,10 @@ TO DO
|
|
10
10
|
|
11
11
|
- #== and #hash methods in MacTypes::Alias, MacTypes::FileURL lack robustness; see notes in mactypes manual for details. Could these be improved? (Note: some mactypes unit tests may fail in some situations due to 'dumb' nature of these methods.)
|
12
12
|
|
13
|
-
- support string encodings in Ruby 1.9
|
13
|
+
- support string encodings in Ruby 1.9
|
14
|
+
|
15
|
+
- document extended error info methods
|
16
|
+
|
17
|
+
- add compatibility flag to AppData for unpacking typeLongDateTime descs as Date instead of Time instances (the latter has limited range)
|
18
|
+
|
19
|
+
- fix strict warnings in Ruby 1.9.1
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
3
3
|
<head>
|
4
4
|
|
5
|
-
<title>aem | 1. Introduction</title>
|
5
|
+
<title>rb-aem manual | 1. Introduction</title>
|
6
6
|
|
7
7
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
8
8
|
<style type="text/css" media="all"><!--@import url(../full.css);--></style>
|
@@ -10,23 +10,34 @@
|
|
10
10
|
</head>
|
11
11
|
<body>
|
12
12
|
|
13
|
-
<h1
|
13
|
+
<h1><img src="../rb-appscript-logo.png" alt="rb-appscript" title="rb-appscript" /></h1>
|
14
14
|
|
15
15
|
<!-- top navigation -->
|
16
16
|
<div class="navbar">
|
17
|
-
|
17
|
+
<a href="index.html">Previous</a> •
|
18
|
+
<a href="index.html">Up</a> •
|
19
|
+
<a href="02_apioverview.html">Next</a>
|
20
|
+
|
21
|
+
<span>
|
22
|
+
<a href="../appscript-manual/index.html">appscript</a> /
|
23
|
+
<a href="../mactypes-manual/index.html">mactypes</a> /
|
24
|
+
<a href="../osax-manual/index.html">osax</a> /
|
25
|
+
<strong><a href="../aem-manual/index.html">aem</a></strong>
|
26
|
+
</span>
|
18
27
|
</div>
|
19
28
|
|
20
29
|
<!-- content -->
|
21
30
|
<div id="content">
|
22
31
|
|
23
|
-
<h2>
|
32
|
+
<h2>1. Introduction</h2>
|
33
|
+
|
34
|
+
<h3>What is aem?</h3>
|
24
35
|
|
25
36
|
<p>The aem package provides a mid-level object-oriented wrapper around the low-level ae extension. It provides the following services:</p>
|
26
37
|
|
27
38
|
<ul>
|
28
39
|
<li>an object-oriented API for constructing Apple Event Object Model queries ("references")</li>
|
29
|
-
<li>data conversion between common Ruby and
|
40
|
+
<li>data conversion between common Ruby and Apple event types</li>
|
30
41
|
<li>AEAddressDesc creation</li>
|
31
42
|
<li>Apple event construction and dispatch.</li>
|
32
43
|
</ul>
|
@@ -38,11 +49,14 @@
|
|
38
49
|
</div>
|
39
50
|
|
40
51
|
<!-- bottom navigation -->
|
41
|
-
|
42
|
-
|
52
|
+
|
53
|
+
<div class="footer">
|
54
|
+
<a href="index.html">Previous</a> •
|
55
|
+
<a href="index.html">Up</a> •
|
56
|
+
<a href="02_apioverview.html">Next</a>
|
57
|
+
|
58
|
+
<span>© 2006-2008 HAS</span>
|
43
59
|
</div>
|
44
60
|
|
45
|
-
<!--footer-->
|
46
|
-
<p class="footer">© 2006-2008 HAS</p>
|
47
61
|
</body>
|
48
62
|
</html>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
3
3
|
<head>
|
4
4
|
|
5
|
-
<title>aem | 2. API overview</title>
|
5
|
+
<title>rb-aem manual | 2. API overview</title>
|
6
6
|
|
7
7
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
8
8
|
<style type="text/css" media="all"><!--@import url(../full.css);--></style>
|
@@ -10,19 +10,30 @@
|
|
10
10
|
</head>
|
11
11
|
<body>
|
12
12
|
|
13
|
-
<h1
|
13
|
+
<h1><img src="../rb-appscript-logo.png" alt="rb-appscript" title="rb-appscript" /></h1>
|
14
14
|
|
15
15
|
<!-- top navigation -->
|
16
16
|
<div class="navbar">
|
17
|
-
|
17
|
+
<a href="01_introduction.html">Previous</a> •
|
18
|
+
<a href="index.html">Up</a> •
|
19
|
+
<a href="03_packingandunpackingdata.html">Next</a>
|
20
|
+
|
21
|
+
<span>
|
22
|
+
<a href="../appscript-manual/index.html">appscript</a> /
|
23
|
+
<a href="../mactypes-manual/index.html">mactypes</a> /
|
24
|
+
<a href="../osax-manual/index.html">osax</a> /
|
25
|
+
<strong><a href="../aem-manual/index.html">aem</a></strong>
|
26
|
+
</span>
|
18
27
|
</div>
|
19
28
|
|
20
29
|
<!-- content -->
|
21
30
|
<div id="content">
|
22
31
|
|
23
|
-
<h2>
|
32
|
+
<h2>2. API overview</h2>
|
24
33
|
|
25
|
-
<
|
34
|
+
<h3>Classes</h3>
|
35
|
+
|
36
|
+
<p>The main AEM classes are as follows:</p>
|
26
37
|
|
27
38
|
<dl>
|
28
39
|
<dt>Application</dt>
|
@@ -45,7 +56,7 @@
|
|
45
56
|
<p>In addition, there are a number of classes used to represent application references, although the user does not instantiate these directly.</p>
|
46
57
|
|
47
58
|
|
48
|
-
<
|
59
|
+
<h3>Methods</h3>
|
49
60
|
|
50
61
|
<p>The AEM module exports three top-level methods for use in constructing application references:</p>
|
51
62
|
|
@@ -64,7 +75,7 @@
|
|
64
75
|
<p>References are constructed from these base objects using chained property/method calls.</p>
|
65
76
|
|
66
77
|
|
67
|
-
<
|
78
|
+
<h3>Modules</h3> <!-- TO DO: improve; move to top -->
|
68
79
|
|
69
80
|
<p>The aem package also exports the following support module:</p>
|
70
81
|
|
@@ -79,11 +90,14 @@
|
|
79
90
|
</div>
|
80
91
|
|
81
92
|
<!-- bottom navigation -->
|
82
|
-
|
83
|
-
|
93
|
+
|
94
|
+
<div class="footer">
|
95
|
+
<a href="01_introduction.html">Previous</a> •
|
96
|
+
<a href="index.html">Up</a> •
|
97
|
+
<a href="03_packingandunpackingdata.html">Next</a>
|
98
|
+
|
99
|
+
<span>© 2006-2008 HAS</span>
|
84
100
|
</div>
|
85
101
|
|
86
|
-
<!--footer-->
|
87
|
-
<p class="footer">© 2006-2008 HAS</p>
|
88
102
|
</body>
|
89
103
|
</html>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
3
3
|
<head>
|
4
4
|
|
5
|
-
<title>aem | 3. Packing and unpacking data</title>
|
5
|
+
<title>rb-aem manual | 3. Packing and unpacking data</title>
|
6
6
|
|
7
7
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
8
8
|
<style type="text/css" media="all"><!--@import url(../full.css);--></style>
|
@@ -10,18 +10,28 @@
|
|
10
10
|
</head>
|
11
11
|
<body>
|
12
12
|
|
13
|
-
<h1
|
13
|
+
<h1><img src="../rb-appscript-logo.png" alt="rb-appscript" title="rb-appscript" /></h1>
|
14
14
|
|
15
15
|
<!-- top navigation -->
|
16
16
|
<div class="navbar">
|
17
|
-
|
17
|
+
<a href="02_apioverview.html">Previous</a> •
|
18
|
+
<a href="index.html">Up</a> •
|
19
|
+
<a href="04_references.html">Next</a>
|
20
|
+
|
21
|
+
<span>
|
22
|
+
<a href="../appscript-manual/index.html">appscript</a> /
|
23
|
+
<a href="../mactypes-manual/index.html">mactypes</a> /
|
24
|
+
<a href="../osax-manual/index.html">osax</a> /
|
25
|
+
<strong><a href="../aem-manual/index.html">aem</a></strong>
|
26
|
+
</span>
|
18
27
|
</div>
|
19
28
|
|
20
29
|
<!-- content -->
|
21
30
|
<div id="content">
|
22
31
|
|
32
|
+
<h2>3. Packing and unpacking data</h2>
|
23
33
|
|
24
|
-
<
|
34
|
+
<h3>Codecs</h3>
|
25
35
|
|
26
36
|
<p>The <code>AEM::Codecs</code> class provides methods for converting Ruby data to <code>AE::AEDesc</code> objects, and vice-versa.</p>
|
27
37
|
|
@@ -49,15 +59,7 @@
|
|
49
59
|
|
50
60
|
|
51
61
|
|
52
|
-
|
53
|
-
|
54
|
-
TO DO: customisation options: subclassing and extending pack/unpack, overriding individual encoder/decoder methods and packUnknown/unpackUnknown; when to instantiate/when to modify; notes on appscript integration; notes on differences to py-appscript Codecs? notes on add_unit_types
|
55
|
-
|
56
|
-
-->
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
<h2>AE types</h2>
|
62
|
+
<h3>AE types</h3>
|
61
63
|
|
62
64
|
<p>The Apple Event Manager defines several types for representing type/class names, enumerator names, etc. that have no direct equivalent in Ruby. Accordingly, aem defines several classes to represent these types on the Ruby side. All share a common abstract base class, <code>AETypeBase</code>:</p>
|
63
65
|
|
@@ -88,11 +90,14 @@ AEKey < AETypeBase -- represents an AE object of typeKeyword</code></pre>
|
|
88
90
|
</div>
|
89
91
|
|
90
92
|
<!-- bottom navigation -->
|
91
|
-
|
92
|
-
|
93
|
+
|
94
|
+
<div class="footer">
|
95
|
+
<a href="02_apioverview.html">Previous</a> •
|
96
|
+
<a href="index.html">Up</a> •
|
97
|
+
<a href="04_references.html">Next</a>
|
98
|
+
|
99
|
+
<span>© 2006-2008 HAS</span>
|
93
100
|
</div>
|
94
101
|
|
95
|
-
<!--footer-->
|
96
|
-
<p class="footer">© 2006-2008 HAS</p>
|
97
102
|
</body>
|
98
103
|
</html>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
3
3
|
<head>
|
4
4
|
|
5
|
-
<title>aem | 4. References</title>
|
5
|
+
<title>rb-aem manual | 4. References</title>
|
6
6
|
|
7
7
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
8
8
|
<style type="text/css" media="all"><!--@import url(../full.css);--></style>
|
@@ -10,18 +10,28 @@
|
|
10
10
|
</head>
|
11
11
|
<body>
|
12
12
|
|
13
|
-
<h1
|
13
|
+
<h1><img src="../rb-appscript-logo.png" alt="rb-appscript" title="rb-appscript" /></h1>
|
14
14
|
|
15
15
|
<!-- top navigation -->
|
16
16
|
<div class="navbar">
|
17
|
-
|
17
|
+
<a href="03_packingandunpackingdata.html">Previous</a> •
|
18
|
+
<a href="index.html">Up</a> •
|
19
|
+
<a href="05_targettingapplications.html">Next</a>
|
20
|
+
|
21
|
+
<span>
|
22
|
+
<a href="../appscript-manual/index.html">appscript</a> /
|
23
|
+
<a href="../mactypes-manual/index.html">mactypes</a> /
|
24
|
+
<a href="../osax-manual/index.html">osax</a> /
|
25
|
+
<strong><a href="../aem-manual/index.html">aem</a></strong>
|
26
|
+
</span>
|
18
27
|
</div>
|
19
28
|
|
20
29
|
<!-- content -->
|
21
30
|
<div id="content">
|
22
31
|
|
32
|
+
<h2>4. References</h2>
|
23
33
|
|
24
|
-
<
|
34
|
+
<h3>About references</h3>
|
25
35
|
|
26
36
|
<p>An Apple Event Object Model query (a.k.a. "reference") essentially consists of a linked list made up of one or more Apple event descriptors (AEDescs) of, for the most part, <code>typeObjectSpecifier</code>. Object specifiers are used to identify properties and elements in the application's AEOM. Each object specifer contains four fields:</p>
|
27
37
|
|
@@ -39,7 +49,7 @@
|
|
39
49
|
<dd>selector data (e.g. in a by-name specifier, this would be a string)</dd>
|
40
50
|
</dl>
|
41
51
|
|
42
|
-
<p>The Apple Event Manager provides several ways to construct object specifiers and assemble them into a complete reference, but these are all rather verbose and low-level.
|
52
|
+
<p>The Apple Event Manager provides several ways to construct object specifiers and assemble them into a complete reference, but these are all rather verbose and low-level. AEM hides all these details behind an object-oriented wrapper that uses chained property and method calls to gather the data needed to create object specifiers and assemble them into linked lists.</p>
|
43
53
|
|
44
54
|
<p>For example, consider the reference <code>text of document 1</code>. The code for constructing this reference using a relatively low-level bridge, in this case RubyAEOSA, would be:</p>
|
45
55
|
|
@@ -68,19 +78,19 @@ p ref
|
|
68
78
|
|
69
79
|
<p>Now, compare the above with the AEM equivalent:</p>
|
70
80
|
|
71
|
-
<pre><code>
|
81
|
+
<pre><code>app.elements('docu').by_index(1).property('ctxt')</code></pre>
|
72
82
|
|
73
|
-
<p>As you can see, AEM still uses low-level four-character codes to identify the <code>text</code> property and <code>document</code> class, but is otherwise a high-level object-oriented API. Once again, each reference begins with a root object, in this case <code>
|
83
|
+
<p>As you can see, AEM still uses low-level four-character codes to identify the <code>text</code> property and <code>document</code> class, but is otherwise a high-level object-oriented API. Once again, each reference begins with a root object, in this case <code>AEM.app</code>. New AEM specifiers are constructed by method calls; each call returning a new specifier object whose own methods can be called, and so on. This allows clients to build up a chain of AEM specifier objects that aem can later pack into AEDescs for sending to applications.</p>
|
74
84
|
|
75
|
-
<p>One more thing to notice: in AEM, specifying a class of elements and indicating which of those elements should be selected are performed by separate method calls, although the information provided will eventually be packed into a single AEDesc of <code>typeObjectSpecifier</code>. This two-step approach makes it easier to integrate aem with the higher-level appscript bridge, which also uses two calls to construct element specifiers (one to specify the element class, e.g. <code
|
85
|
+
<p>One more thing to notice: in AEM, specifying a class of elements and indicating which of those elements should be selected are performed by separate method calls, although the information provided will eventually be packed into a single AEDesc of <code>typeObjectSpecifier</code>. This two-step approach makes it easier to integrate aem with the higher-level appscript bridge, which also uses two calls to construct element specifiers (one to specify the element class, e.g. <code>#document</code>, and another to specify the selection, e.g. <code>#by_index</code>).</p>
|
76
86
|
|
77
|
-
<p>Note that <code>
|
87
|
+
<p>Note that <code>app.elements('docu')</code> is itself a valid reference, identifying <em>all</em> the document elements of the application class. You do not have to call an explicit <code>#all</code> selector (indeed, none is provided) as AEM automatically handles the details for you. AEM even allows for some convenient shorthand, e.g. writing:</p>
|
78
88
|
|
79
|
-
<pre><code>
|
89
|
+
<pre><code>app.elements('docu')by_filter(...).first</code></pre>
|
80
90
|
|
81
91
|
<p>is equivalent to writing:</p>
|
82
92
|
|
83
|
-
<pre><code>
|
93
|
+
<pre><code>app.elements('docu')by_filter(...).elements('docu').first</code></pre>
|
84
94
|
|
85
95
|
<p>This allows clients to specify the first document that matches the given condition without having to specify the element class a second time. In AppleScript, the equivalent to this is:</p>
|
86
96
|
|
@@ -94,9 +104,9 @@ p ref
|
|
94
104
|
|
95
105
|
|
96
106
|
|
97
|
-
<
|
107
|
+
<h3>Reference forms</h3>
|
98
108
|
|
99
|
-
<p>
|
109
|
+
<p>AEM defines a number of classes representing each of the AEOM reference forms. There are eight AEOM reference forms:</p>
|
100
110
|
|
101
111
|
<ul>
|
102
112
|
<li>insertion location</li>
|
@@ -121,7 +131,7 @@ p ref
|
|
121
131
|
|
122
132
|
|
123
133
|
|
124
|
-
TO DO: finish
|
134
|
+
<!-- TO DO: finish -->
|
125
135
|
|
126
136
|
|
127
137
|
<p>In fact, it really isn't necessary to remember the reference class hierarchy at all, only to know which concrete classes implement which methods. All user-accessible properties and methods are defined by just four superclasses:</p>
|
@@ -142,9 +152,9 @@ TO DO: finish
|
|
142
152
|
|
143
153
|
|
144
154
|
|
145
|
-
<
|
155
|
+
<h3>Base classes</h3>
|
146
156
|
|
147
|
-
<
|
157
|
+
<h4>Basic methods</h4>
|
148
158
|
|
149
159
|
<pre><code>BASE -- Base class for all reference form and test clause classes.
|
150
160
|
hash -- aem references can be used as dictionary keys
|
@@ -152,7 +162,7 @@ TO DO: finish
|
|
152
162
|
==(value) -- aem references can be compared for equality</code></pre>
|
153
163
|
|
154
164
|
|
155
|
-
<
|
165
|
+
<h4>Methods for all position specifiers</h4>
|
156
166
|
|
157
167
|
<pre><code>PositionSpecifier < Specifier -- base class for all property and element
|
158
168
|
reference forms (i.e. all forms except insertion location)
|
@@ -235,7 +245,7 @@ TO DO: finish
|
|
235
245
|
Result : Test</code></pre>
|
236
246
|
|
237
247
|
|
238
|
-
<
|
248
|
+
<h4>Methods for all multi-element specifiers</h4>
|
239
249
|
|
240
250
|
<pre><code>MultipleElements < PositionSpecifier -- base class for all multi-
|
241
251
|
element reference forms
|
@@ -277,7 +287,7 @@ TO DO: finish
|
|
277
287
|
Result : ElementsByFilter</code></pre>
|
278
288
|
|
279
289
|
|
280
|
-
<
|
290
|
+
<h4>Methods for all test clause classes</h4>
|
281
291
|
|
282
292
|
<pre><code>Test < BASE -- represents a comparison/logic test
|
283
293
|
|
@@ -300,14 +310,14 @@ TO DO: finish
|
|
300
310
|
|
301
311
|
|
302
312
|
|
303
|
-
<
|
313
|
+
<h3>Concrete classes</h3>
|
304
314
|
|
305
|
-
<
|
315
|
+
<h4>Insertion location reference form</h4>
|
306
316
|
|
307
317
|
<pre><code>InsertionSpecifier < Specifier -- refers to insertion point before or after/at
|
308
318
|
beginning or end of element(s); e.g. ref.before</code></pre>
|
309
319
|
|
310
|
-
<
|
320
|
+
<h4>Property reference forms</h4>
|
311
321
|
|
312
322
|
<pre><code>Property < PositionSpecifier -- refers to a property (whose value
|
313
323
|
may be a basic type, application object or reference);
|
@@ -318,7 +328,7 @@ UserProperty < PositionSpecifier -- refers to a user-defined property
|
|
318
328
|
(typically in an OSA applet); e.g. ref.user_property('myVar')</code></pre>
|
319
329
|
|
320
330
|
|
321
|
-
<
|
331
|
+
<h4>Single element reference forms</h4>
|
322
332
|
|
323
333
|
|
324
334
|
<pre><code>ElementByIndex < SingleElement -- refers to a single element in the referenced
|
@@ -341,7 +351,7 @@ ElementByRelativePosition < SingleElement -- refers to the previous or next e
|
|
341
351
|
e.g. ref.next('cpar')</code></pre>
|
342
352
|
|
343
353
|
|
344
|
-
<
|
354
|
+
<h4>Multiple element reference forms</h4>
|
345
355
|
|
346
356
|
<pre><code>ElementsByRange < MultipleElements -- refers to a range of elements
|
347
357
|
in the referenced container object(s) (including beginning and
|
@@ -358,23 +368,23 @@ AllElements < MultipleElements -- refers to all elements of the given class
|
|
358
368
|
in the referenced container object(s); e.g. ref.elements('docu')</code></pre>
|
359
369
|
|
360
370
|
|
361
|
-
<
|
371
|
+
<h4>Tests</h4>
|
362
372
|
|
363
373
|
<p>The <code>Test</code> class represents a comparison test or logical test, and defines methods for composing additional logical tests on top of these. Each kind of test clause is represented by a different subclass of the main <code>Test</code> class. The details are not that important, however, so they're not listed here.</p>
|
364
374
|
|
365
375
|
|
366
376
|
|
367
377
|
|
368
|
-
<
|
378
|
+
<h4>Reference Roots</h4>
|
369
379
|
|
370
|
-
<pre><code>ApplicationRoot < PositionSpecifier
|
371
|
-
this class
|
380
|
+
<pre><code>ApplicationRoot < PositionSpecifier
|
381
|
+
-- AEM.app returns an instance of this class
|
372
382
|
|
373
|
-
CurrentContainer < PositionSpecifier
|
374
|
-
this class
|
383
|
+
CurrentContainer < PositionSpecifier
|
384
|
+
-- AEM.con returns an instance of this class
|
375
385
|
|
376
|
-
ObjectBeingExamined < PositionSpecifier
|
377
|
-
of this class</code></pre>
|
386
|
+
ObjectBeingExamined < PositionSpecifier
|
387
|
+
-- AEM.its returns an instance of this class</code></pre>
|
378
388
|
|
379
389
|
|
380
390
|
|
@@ -384,11 +394,14 @@ ObjectBeingExamined < PositionSpecifier -- AEM.its returns an instance
|
|
384
394
|
</div>
|
385
395
|
|
386
396
|
<!-- bottom navigation -->
|
387
|
-
|
388
|
-
|
397
|
+
|
398
|
+
<div class="footer">
|
399
|
+
<a href="03_packingandunpackingdata.html">Previous</a> •
|
400
|
+
<a href="index.html">Up</a> •
|
401
|
+
<a href="05_targettingapplications.html">Next</a>
|
402
|
+
|
403
|
+
<span>© 2006-2008 HAS</span>
|
389
404
|
</div>
|
390
405
|
|
391
|
-
<!--footer-->
|
392
|
-
<p class="footer">© 2006-2008 HAS</p>
|
393
406
|
</body>
|
394
407
|
</html>
|