rb-appscript 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. data/CHANGES +28 -0
  2. data/README +51 -31
  3. data/doc/aem-manual/01_introduction.html +0 -2
  4. data/doc/aem-manual/02_apioverview.html +13 -9
  5. data/doc/aem-manual/03_packingandunpackingdata.html +41 -9
  6. data/doc/aem-manual/04_references.html +42 -40
  7. data/doc/aem-manual/{05_targettingapplications.html → 05_targetingapplications.html} +4 -6
  8. data/doc/aem-manual/06_buildingandsendingevents.html +40 -12
  9. data/doc/aem-manual/07_findapp.html +0 -2
  10. data/doc/aem-manual/08_examples.html +0 -2
  11. data/doc/aem-manual/aemreferenceinheritance.gif +0 -0
  12. data/doc/aem-manual/index.html +1 -3
  13. data/doc/appscript-manual/01_introduction.html +0 -2
  14. data/doc/appscript-manual/02_aboutappscripting.html +4 -6
  15. data/doc/appscript-manual/03_quicktutorial.html +1 -3
  16. data/doc/appscript-manual/04_gettinghelp.html +20 -7
  17. data/doc/appscript-manual/05_keywordconversion.html +5 -3
  18. data/doc/appscript-manual/06_classesandenums.html +32 -8
  19. data/doc/appscript-manual/07_applicationobjects.html +30 -41
  20. data/doc/appscript-manual/08_realvsgenericreferences.html +0 -2
  21. data/doc/appscript-manual/09_referenceforms.html +0 -2
  22. data/doc/appscript-manual/10_referenceexamples.html +1 -3
  23. data/doc/appscript-manual/11_applicationcommands.html +29 -2
  24. data/doc/appscript-manual/12_commandexamples.html +0 -2
  25. data/doc/appscript-manual/13_performanceissues.html +0 -2
  26. data/doc/appscript-manual/14_notes.html +0 -19
  27. data/doc/appscript-manual/index.html +0 -2
  28. data/doc/index.html +1 -4
  29. data/doc/mactypes-manual/01_introduction.html +0 -2
  30. data/doc/mactypes-manual/02_aliasclass.html +0 -10
  31. data/doc/mactypes-manual/03_fileurlclass.html +1 -11
  32. data/doc/mactypes-manual/04_unitsclass.html +0 -2
  33. data/doc/mactypes-manual/index.html +0 -2
  34. data/doc/osax-manual/01_introduction.html +0 -2
  35. data/doc/osax-manual/02_interface.html +0 -2
  36. data/doc/osax-manual/03_examples.html +0 -2
  37. data/doc/osax-manual/04_notes.html +6 -25
  38. data/doc/osax-manual/index.html +0 -2
  39. data/rb-appscript.gemspec +2 -3
  40. data/sample/AB_export_vcard.rb +0 -0
  41. data/sample/AB_list_people_with_emails.rb +0 -0
  42. data/sample/Create_daily_iCal_todos.rb +0 -0
  43. data/sample/Export_Address_Book_phone_numbers.rb +0 -0
  44. data/sample/Hello_world.rb +0 -0
  45. data/sample/List_iTunes_playlist_names.rb +0 -0
  46. data/sample/Open_file_in_TextEdit.rb +0 -0
  47. data/sample/Organize_Mail_messages.rb +0 -0
  48. data/sample/TextEdit_demo.rb +0 -0
  49. data/sample/iTunes_top40_to_html.rb +0 -0
  50. data/src/SendThreadSafe.c +0 -0
  51. data/src/SendThreadSafe.h +0 -0
  52. data/src/lib/_aem/aemreference.rb +5 -7
  53. data/src/lib/_aem/codecs.rb +47 -24
  54. data/src/lib/_aem/connect.rb +29 -8
  55. data/src/lib/_aem/encodingsupport.rb +77 -0
  56. data/src/lib/_aem/findapp.rb +0 -2
  57. data/src/lib/_aem/mactypes.rb +0 -2
  58. data/src/lib/_aem/send.rb +6 -8
  59. data/src/lib/_aem/typewrappers.rb +0 -2
  60. data/src/lib/_appscript/defaultterminology.rb +0 -2
  61. data/src/lib/_appscript/referencerenderer.rb +1 -3
  62. data/src/lib/_appscript/reservedkeywords.rb +0 -2
  63. data/src/lib/_appscript/safeobject.rb +58 -9
  64. data/src/lib/_appscript/terminology.rb +63 -46
  65. data/src/lib/aem.rb +3 -4
  66. data/src/lib/appscript.rb +12 -13
  67. data/src/lib/osax.rb +436 -9
  68. data/src/rbae.c +126 -103
  69. data/test/test_aemreference.rb +0 -0
  70. data/test/test_appscriptcommands.rb +15 -1
  71. data/test/test_appscriptreference.rb +0 -0
  72. data/test/test_codecs.rb +10 -4
  73. data/test/test_findapp.rb +0 -0
  74. data/test/test_mactypes.rb +0 -0
  75. data/test/test_osax.rb +0 -0
  76. data/test/testall.sh +0 -0
  77. metadata +24 -24
  78. data/LICENSE +0 -70
  79. data/TODO +0 -19
data/CHANGES CHANGED
@@ -1,3 +1,31 @@
1
+ 2010-12-20 -- 0.6.1
2
+
3
+ - removed 32-bit only AE.run_application_event_loop, AE.quit_application_event_loop
4
+
5
+ - updated AE.launch_application to use LSOpenApplication
6
+
7
+
8
+ 2010-12-17 -- 0.6.0
9
+
10
+ - added UTF-8 Encoding support in Ruby 1.9+; added AEMCodecs::Codecs#use_ascii_8bit for optionally disabling it
11
+
12
+ - AEM::Codecs#pack now accepts Date, DateTime instances; added AEM::Codecs#use_date_time method for unpacking typeLongDateTime descriptors as DateTime instead of Time instances
13
+
14
+ - removed AE.get_app_terminology() as it relied on deprecated Carbon APIs
15
+
16
+ - added AE.copy_scripting_definition()
17
+
18
+ - the OSAX module now now uses OSACopyScriptingDefinition() to obtain scripting addition terminology, so works in both 32- and 64-bit Ruby. Note that in addition to limitations of OSACopyScriptingDefinition (e.g. aete-to-sdef conversion is not 100% reliable), the SdefParser is limited in capability (no support for xi:include, class-extension, synonym elements), but should suffice for parsing relatively simple osax dictionaries.
19
+
20
+ - modified Terminology.dump() to retrieve aete resources via 'ascrgdte' events; added OSAX.dump() method
21
+
22
+ - added workaround for transaction id bug in some versions of OS X 10.6
23
+
24
+ - renamed AEMReference::Base class to AEMReference::Query
25
+
26
+ - renamed Send::CommandError class to Send::EventError; note that AEM re-exports it as AEM::EventError and [for backwards compatibilty] AEM::CommandError
27
+
28
+
1
29
  2009-07-18 -- 0.5.3
2
30
 
3
31
  - fixed pALL code in defaultterminology
data/README CHANGED
@@ -1,53 +1,73 @@
1
- Appscript Read Me
1
+ About rb-appscript
2
+ ==================
2
3
 
3
- ======================================================================
4
- ABOUT
4
+ Ruby appscript (rb-appscript) is a high-level, user-friendly Apple event
5
+ bridge that allows you to control AppleScriptable Mac OS X applications
6
+ from Ruby.
5
7
 
6
- Ruby appscript (rb-appscript) is a high-level Apple event bridge for the Ruby scripting language. rb-appscript is closely based on the Python appscript (py-appscript) bridge.
7
8
 
8
- See the doc folder for more information.
9
+ Requirements
10
+ ------------
9
11
 
10
- ======================================================================
11
- REQUIREMENTS
12
+ Appscript supports Ruby 1.8 and later.
12
13
 
13
- - Mac OS X 10.3+
14
- - Ruby 1.8+
14
+ Appscript requires Mac OS X 10.4 or later.
15
15
 
16
- ======================================================================
17
- INSTALLATION
18
16
 
19
- $ ruby extconf.rb
20
- $ make
21
- $ sudo make install
17
+ Installation
18
+ ------------
22
19
 
23
- -------
20
+ To install appscript, cd to the rb-appscript-0.6.0 directory and run:
24
21
 
25
- Please note that the version of Ruby included with Mac OS X 10.4 (Tiger) is missing the header files needed to build appscript on PPC-based Macs. Tiger users can avoid this issue by installing the latest version of Ruby from <http://www.ruby-lang.org/en/downloads/> and updating their shell login profiles to suit.
22
+ ruby extconf.rb
23
+ make
24
+ make install
26
25
 
27
- ======================================================================
28
- NOTES
29
26
 
30
- - Developer tools for exporting application dictionaries (ASDictionary) and converting application commands from AppleScript to appscript syntax (ASTranslate) are available separately:
27
+ Building appscript from source requires the gcc compiler supplied with
28
+ Apple's Xcode IDE. Xcode can be obtained from Mac OS X installer disks
29
+ or <http://developer.apple.com>.
31
30
 
32
- http://appscript.sourceforge.net/tools.html
31
+ Please note that the version of Ruby included with Mac OS X 10.4 (Tiger)
32
+ is missing the header files needed to build appscript on PPC-based Macs.
33
+ Tiger users can avoid this issue by installing the latest version of Ruby
34
+ from <http://www.ruby-lang.org/en/downloads/> and updating their shell
35
+ login profiles to suit.
33
36
 
34
- - This is a beta release. Please file bug reports if you encounter any problems.
35
37
 
36
- - rb-appscript 0.5.2 contains bug and compatibility fixes; see the CHANGES file and documentation for details.
38
+ Notes
39
+ -----
37
40
 
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.
41
+ - rb-appscript 0.6.0 supports string encodings in Ruby 1.9+; see the CHANGES
42
+ file and documentation for details.
39
43
 
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.
44
+ - Developer tools for exporting application dictionaries (ASDictionary)
45
+ and converting application commands from AppleScript to appscript syntax
46
+ (ASTranslate) are available separately:
41
47
 
48
+ http://appscript.sourceforge.net/tools.html
42
49
 
43
- ======================================================================
44
- AUTHOR
50
+ ASDictionary 0.13.1 or later is also required to use rb-appscript's built-
51
+ in #help method. If ASDictionary isn't installed, interactive help won't
52
+ be available but appscript will continue to operate as normal.
45
53
 
46
- - HAS -- hhas -at- users - sourceforge - net <http://rb-appscript.rubyforge.org> <http://appscript.sourceforge.net>
54
+ - This is a Beta release. Please report any issues you find, particularly in
55
+ the new Ruby 1.9 string encoding support which is not yet heavily tested.
56
+ If no major problems are reported, Release Candidate 1 will follow.
47
57
 
48
- ======================================================================
49
- COPYRIGHT
50
58
 
51
- Copyright (C) 2006-2009 HAS
59
+ Copyright
60
+ ---------
52
61
 
53
- Appscript is released under the MIT License. See the LICENSE file for more information.
62
+ Appscript is released into the public domain, except for the following code:
63
+
64
+ - extconf.rb, which is a modified version of the RubyAEOSA/RubyOSA install
65
+ script; see code for details
66
+
67
+ - safeobject.rb, which is a modified version of basicobject
68
+ <http://facets.rubyforge.org> released under the Ruby License;
69
+ see code for details
70
+
71
+ - SendThreadSafe.h/SendThreadSafe.m, which are modified versions of Apple
72
+ code (http://developer.apple.com/samplecode/AESendThreadSafe); see code
73
+ for details
@@ -54,8 +54,6 @@
54
54
  <a href="index.html">Previous</a> &bull;
55
55
  <a href="index.html">Up</a> &bull;
56
56
  <a href="02_apioverview.html">Next</a>
57
-
58
- <span>&copy; 2006-2008 HAS</span>
59
57
  </div>
60
58
 
61
59
  </body>
@@ -37,16 +37,16 @@
37
37
 
38
38
  <dl>
39
39
  <dt>Application</dt>
40
- <dd>Represents a scriptable application, and provides an <code>event</code> method for constructing Apple events.</dd>
40
+ <dd>Represents a scriptable application, and provides an <code>#event</code> method for constructing Apple events.</dd>
41
41
 
42
42
  <dt>Event</dt>
43
- <dd>Represents a ready-to-send Apple event, and provides a <code>send</code> method for sending it. Returned by the <code>Application</code> class's <code>event</code> method.</dd>
43
+ <dd>Represents a ready-to-send Apple event, and provides a <code>#send</code> method for sending it. Returned by the <code>Application</code> class's <code>#event</code> method.</dd>
44
44
 
45
- <dt>CommandError</dt>
45
+ <dt>EventError</dt>
46
46
  <dd>Exception raised to indicate an application or Apple Event Manager error.</dd>
47
47
 
48
48
  <dt>Codecs</dt>
49
- <dd>Provides <code>pack</code> and <code>unpack</code> methods for converting Ruby values to AE types, and vice-versa. Clients usually don't need to access this class directly.</dd>
49
+ <dd>Provides <code>#pack</code> and <code>#unpack</code> methods for converting Ruby values to AE types, and vice-versa. Clients usually don't need to access this class directly.</dd>
50
50
 
51
51
  <dt>AEType, AEEnum</dt>
52
52
  <dd>Represent Apple event type and enumerator values.</dd>
@@ -72,17 +72,23 @@
72
72
  </dl>
73
73
 
74
74
 
75
- <p>References are constructed from these base objects using chained property/method calls.</p>
75
+ <p>References are constructed from these base objects using chained method calls.</p>
76
76
 
77
77
 
78
- <h3>Modules</h3> <!-- TO DO: improve; move to top -->
78
+ <h3>Modules</h3>
79
79
 
80
- <p>The aem package also exports the following support module:</p>
80
+ <p>The following support modules are also provided:</p>
81
81
 
82
82
  <dl>
83
83
  <dt>FindApp</dt>
84
84
  <dd>Provides functions for locating applications by name, bundle id or creator code.</dd>
85
85
 
86
+ <dt>AE</dt>
87
+ <dd>Low-level extension that defines an <code>AEDesc</code> class representing Carbon Apple event descriptors (AEDescs). Also provides a number of support methods used by AEM, appscript and related packages.</dd>
88
+
89
+ <dt>KAE</dt>
90
+ <dd>Exports constants defined by Apple Event Manager and Open Scripting APIs.</dd>
91
+
86
92
  </dl>
87
93
 
88
94
 
@@ -95,8 +101,6 @@
95
101
  <a href="01_introduction.html">Previous</a> &bull;
96
102
  <a href="index.html">Up</a> &bull;
97
103
  <a href="03_packingandunpackingdata.html">Next</a>
98
-
99
- <span>&copy; 2006-2008 HAS</span>
100
104
  </div>
101
105
 
102
106
  </body>
@@ -41,7 +41,9 @@
41
41
  new
42
42
 
43
43
  Methods:
44
-
44
+
45
+ # pack/unpack data
46
+
45
47
  pack(data) -- convert Ruby data to an AEDesc; will raise
46
48
  a TypeError if data's type/class is unsupported
47
49
  data : anything
@@ -51,10 +53,40 @@
51
53
  the AEDesc unchanged if it's an unsupported type
52
54
  desc : AEDesc
53
55
  Result : anything
54
-
55
- add_unit_types(types) -- register custom unit type definitions
56
- types : list -- a list of lists, where each sublist is of form
57
- [name, code] or [name, code, pack_proc, unpack_proc]</code></pre>
56
+
57
+ # compatibility options
58
+
59
+ add_unit_types(types) -- register custom unit type
60
+ definitions
61
+ types : list -- a list of lists, where each sublist
62
+ is of form [name, code, pack_proc, unpack_proc]
63
+ or [name, code]; if the packer and unpacker
64
+ procs are omitted, the AEDesc data is packed/
65
+ unpacked as a double-precision float
66
+
67
+ dont_cache_unpacked_specifiers -- by default, object
68
+ specifier descriptors returned by an application
69
+ are reused for efficiency; invoke this method to
70
+ use AppleScript-style behavior instead (i.e. fully
71
+ unpacking and repacking object specifiers each time)
72
+ for better compatibility with problem applications
73
+
74
+ pack_strings_as_type(code) -- by default, strings are
75
+ packed as typeUnicodeText descriptors; some older
76
+ non-Unicode-aware applications may require text
77
+ to be supplied as typeChar/typeIntlText descriptors
78
+ code : String -- four-char code, e.g. KAE::TypeChar
79
+ (see KAE module for available text types)
80
+
81
+ use_ascii_8bit -- by default, text descriptors are unpacked
82
+ as Strings with UTF-8 Encoding on Ruby 1.9+; invoke
83
+ this method to mimic Ruby 1.8-style behavior where
84
+ Strings contain UTF-8 encoded data and ASCII-8BIT
85
+ Encoding
86
+
87
+ use_datetime -- by default, dates are unpacked as Time
88
+ instances; invoke this method to unpack dates as
89
+ DateTime instances instead</code></pre>
58
90
 
59
91
 
60
92
 
@@ -71,10 +103,12 @@
71
103
 
72
104
  Methods:
73
105
  code
74
- Result : str -- the four-character code
106
+ Result : str -- Apple event code</code></pre>
75
107
 
76
108
 
77
- AEType &lt; AETypeBase -- represents an AE object of typeType
109
+ <p>The four concrete classes are:</p>
110
+
111
+ <pre><code>AEType &lt; AETypeBase -- represents an AE object of typeType
78
112
 
79
113
 
80
114
  AEEnum &lt; AETypeBase -- represents an AE object of typeEnumeration
@@ -95,8 +129,6 @@ AEKey &lt; AETypeBase -- represents an AE object of typeKeyword</code></pre>
95
129
  <a href="02_apioverview.html">Previous</a> &bull;
96
130
  <a href="index.html">Up</a> &bull;
97
131
  <a href="04_references.html">Next</a>
98
-
99
- <span>&copy; 2006-2008 HAS</span>
100
132
  </div>
101
133
 
102
134
  </body>
@@ -16,7 +16,7 @@
16
16
  <div class="navbar">
17
17
  <a href="03_packingandunpackingdata.html">Previous</a> &bull;
18
18
  <a href="index.html">Up</a> &bull;
19
- <a href="05_targettingapplications.html">Next</a>
19
+ <a href="05_targetingapplications.html">Next</a>
20
20
 
21
21
  <span>
22
22
  <a href="../appscript-manual/index.html">appscript</a> /
@@ -49,32 +49,28 @@
49
49
  <dd>selector data (e.g. in a by-name specifier, this would be a string)</dd>
50
50
  </dl>
51
51
 
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>
52
+ <p>The Apple Event Manager (and, in turn, the <code>AE</code> extension) 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>
53
53
 
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>
54
+ <p>For example, consider the reference <code>text of document 1</code>. The code for constructing this reference using the low-level <code>AE</code> bridge would be:</p>
55
55
 
56
- <pre><code>ref = OSX::AEDesc.null
56
+ <pre><code>rootref = AE::AEDesc.new("null", "")
57
57
 
58
- ref = OSX::AEDesc.record({
59
- 'want' =&gt; OSX::AEDesc.new('type', 'docu'),
60
- 'from' =&gt; ref,
61
- 'form' =&gt; OSX::AEDesc.new('enum', 'indx'),
62
- 'seld' =&gt; 1,
63
- }).coerce('obj ')
58
+ docref = AE::AEDesc.new_list(true).coerce("obj ")
59
+ docref.put_param("want", AE::AEDesc.new("type", "docu"))
60
+ docref.put_param("from", rootref)
61
+ docref.put_param("form", AE::AEDesc.new("enum", "indx"))
62
+ docref.put_param("seld", AE::AEDesc.new("long", "\x00\x00\x00\x01"))
64
63
 
65
- ref = OSX::AEDesc.record({
66
- 'want' =&gt; OSX::AEDesc.new('type', 'prop'),
67
- 'from' =&gt; ref,
68
- 'form' =&gt; OSX::AEDesc.new('enum', 'prop'),
69
- 'seld' =&gt; OSX::AEDesc.new('type', 'ctxt'),
70
- }).coerce('obj ')
64
+ textref = AE::AEDesc.new_list(true).coerce("obj ")
65
+ textref.put_param("want", AE::AEDesc.new("type", "prop"))
66
+ textref.put_param("from", docref)
67
+ textref.put_param("form", AE::AEDesc.new("enum", "prop"))
68
+ textref.put_param("seld", AE::AEDesc.new("type", "ctxt"))
71
69
 
72
- p ref
73
- #&lt;AEDesc:0x57594 type='obj '&gt;</code></pre>
70
+ p textref
71
+ #&lt;AE::AEDesc type="obj " size=152&gt;</code></pre>
74
72
 
75
- <p>(The equivalent C code is even lower-level and more verbose.)</p>
76
-
77
- <p>This code works by creating each AEDesc of <code>typeAERecord</code> in turn, populating it, then coercing it to <code>typeObjectSpecifier</code>. Each AEDesc is nested within the next to form a linked list of object specifier records; the last (innermost) descriptor in the finished list indicates the reference's root object in the AEOM (in this case, the <code>application</code> object, which is represented by a null descriptor).</p>
73
+ <p>This code works by creating an AEDesc of <code>typeObjectSpecifier</code> to represent each specifier and populating its fields one at a time. Each AEDesc is nested within the next to form a linked list of object specifier records; the last (innermost) descriptor in the finished list indicates the reference's root object in the AEOM (in this case, the <code>application</code> object, which is represented by a null descriptor).</p>
78
74
 
79
75
  <p>Now, compare the above with the AEM equivalent:</p>
80
76
 
@@ -82,7 +78,7 @@ p ref
82
78
 
83
79
  <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>
84
80
 
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>
81
+ <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>documents</code>, and another to specify the selection, e.g. <code>[1]</code>).</p>
86
82
 
87
83
  <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>
88
84
 
@@ -119,25 +115,20 @@ p ref
119
115
  <li>elements by test</li>
120
116
  </ul>
121
117
 
122
- <p>(Actually, there's nine forms if you count the 'user property' reference form, although this is only used by OSA (e.g. Script Editor) applets to identify script properties. AEM supports this extra form more for sake of completeness than usefulness.)</p>
118
+ <p>(Actually, there's nine forms if you count the 'user property' reference form, although this is only used by OSA (e.g. AppleScript Editor) applets to identify script properties. AEM supports this extra form more for sake of completeness than usefulness.)</p>
123
119
 
124
120
  <p>Each of these reference forms is represented by a different AEM specifier class, apart from the absolute position form which is represented by three different classes according to the kind of selector used: a numerical index (e.g. <code>1</code>, <code>-3</code>), a named ordinal identifying a single element (<code>first</code>, <code>middle</code>, <code>last</code>, <code>any</code>), or a named ordinal identifying all elements (<code>all</code>).</p>
125
121
 
126
- <p>The following diagram shows the aem reference class hierarchy (slightly simplified for legibility); concrete classes are shown in bold:</p>
127
-
128
- <p><img src="aemreferenceinheritance.gif" title="aem reference class hierarchy" />
129
-
130
- <p>Note that the user shouldn't instantiate these classes directly; instead, AEM will instantiate them as appropriate when the client calls the methods of other AEM specifier objects, starting with the <code>app</code>, <code>con</code> and <code>its</code> objects that form the root of all aem references.</p>
122
+ <p>The following diagram shows the AEM reference class hierarchy (slightly simplified for legibility); concrete classes are shown in bold:</p>
131
123
 
124
+ <p><img src="aemreferenceinheritance.gif" alt="AEM reference class hierarchy" title="AEM reference class hierarchy" /></p>
132
125
 
133
-
134
- <!-- TO DO: finish -->
135
-
126
+ <p>Note that the user shouldn't instantiate these classes directly; instead, AEM will instantiate them as appropriate when the client calls the methods of other AEM reference objects, starting with the <code>app</code>, <code>con</code> and <code>its</code> objects that form the root of all AEM references.</p>
136
127
 
137
128
  <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>
138
129
 
139
130
  <dl>
140
- <dt><code>BASE</code></dt>
131
+ <dt><code>Query</code></dt>
141
132
  <dd>Defines comparison and hashing methods.</dd>
142
133
 
143
134
  <dt><code>PositionSpecifier</code></dt>
@@ -156,7 +147,7 @@ p ref
156
147
 
157
148
  <h4>Basic methods</h4>
158
149
 
159
- <pre><code>BASE -- Base class for all reference form and test clause classes.
150
+ <pre><code>Query -- Base class for all reference form and test clause classes.
160
151
  hash -- aem references can be used as dictionary keys
161
152
 
162
153
  ==(value) -- aem references can be compared for equality</code></pre>
@@ -289,7 +280,7 @@ p ref
289
280
 
290
281
  <h4>Methods for all test clause classes</h4>
291
282
 
292
- <pre><code>Test &lt; BASE -- represents a comparison/logic test
283
+ <pre><code>Test &lt; Query -- represents a comparison/logic test
293
284
 
294
285
  Methods:
295
286
 
@@ -305,8 +296,8 @@ p ref
305
296
  objects
306
297
  Result : Test
307
298
 
308
- not
309
- Result : Test -- apply a logical 'not' test to self</code></pre>
299
+ not -- apply a logical 'not' test to self
300
+ Result : Test</code></pre>
310
301
 
311
302
 
312
303
 
@@ -377,6 +368,8 @@ AllElements &lt; MultipleElements -- refers to all elements of the given class
377
368
 
378
369
  <h4>Reference Roots</h4>
379
370
 
371
+ <p>The following classes are used to construct standard AEM references:</p>
372
+
380
373
  <pre><code>ApplicationRoot &lt; PositionSpecifier
381
374
  -- AEM.app returns an instance of this class
382
375
 
@@ -386,9 +379,20 @@ CurrentContainer &lt; PositionSpecifier
386
379
  ObjectBeingExamined &lt; PositionSpecifier
387
380
  -- AEM.its returns an instance of this class</code></pre>
388
381
 
382
+ <p>Clients shouldn't instantiate the above classes directly; instead, they should use the <code>AEM.app</code>, <code>AEM.con</code> and <code>AEM.its</code> methods which return the appropriate objects.</p>
383
+
384
+ <p>The <code>CustomRoot</code> class is used to construct AEM references with a non-standard root:</p>
385
+
386
+ <pre><code>CustomRoot(ReferenceRoot) -- used to construct references with
387
+ a custom root
389
388
 
389
+ Constructor:
390
390
 
391
- <!-- TO DO: note on AEM_resolve -->
391
+ initialize(value)
392
+ value : anything -- value to use as innermost container
393
+ in nested object specifiers</code></pre>
394
+
395
+ <p>Clients can use the <code>AEM.custom_root</code> method to create new <code>CustomRoot</code> instances, passing the root object as method's sole argument.</p>
392
396
 
393
397
 
394
398
  </div>
@@ -398,9 +402,7 @@ ObjectBeingExamined &lt; PositionSpecifier
398
402
  <div class="footer">
399
403
  <a href="03_packingandunpackingdata.html">Previous</a> &bull;
400
404
  <a href="index.html">Up</a> &bull;
401
- <a href="05_targettingapplications.html">Next</a>
402
-
403
- <span>&copy; 2006-2008 HAS</span>
405
+ <a href="05_targetingapplications.html">Next</a>
404
406
  </div>
405
407
 
406
408
  </body>
@@ -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>rb-aem manual | 5. Targetting Applications</title>
5
+ <title>rb-aem manual | 5. Targeting Applications</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>
@@ -29,7 +29,7 @@
29
29
  <!-- content -->
30
30
  <div id="content">
31
31
 
32
- <h2>5. Targetting Applications</h2>
32
+ <h2>5. Targeting Applications</h2>
33
33
 
34
34
  <h3>The <code>Application</code> class</h3>
35
35
 
@@ -109,7 +109,7 @@
109
109
 
110
110
  <h3>Creating <code>Application</code> objects</h3>
111
111
 
112
- <p>When targetting a local application by path, the full path to the application (or application bundle) must be given, including a <code>.app</code> suffix if present. Note that aem identifies local applications by process serial number for reliability. If the target application is not already running when a new <code>Application</code> instance is created, it will be started automatically so that a PSN can be acquired. If the application can't be launched for some reason (e.g. if it's in the Trash), an <code>AEM::CantLaunchApplicationError</code> error will be raised.</p>
112
+ <p>When targeting a local application by path, the full path to the application (or application bundle) must be given, including a <code>.app</code> suffix if present. Note that aem identifies local applications by process serial number for reliability. If the target application is not already running when a new <code>Application</code> instance is created, it will be started automatically so that a PSN can be acquired. If the application can't be launched for some reason (e.g. if it's in the Trash), an <code>AEM::CantLaunchApplicationError</code> error will be raised.</p>
113
113
 
114
114
  <p>If the <code>by_url</code> constructor is used, its <code>url</code> argument should be an eppc URL string. Aem will pack this as an <code>AEDesc</code> of <code>typeApplicationURL</code>. The target machine must have Remote Apple Events enabled in its Sharing preferences.</p>
115
115
 
@@ -141,7 +141,7 @@ KAE::TypeProcessSerialNumber</code></pre>
141
141
 
142
142
  <h3>Reconnecting to local applications</h3>
143
143
 
144
- <p>Because local applications are identified by process serial number, an existing <code>Application</code> object created using the <code>by_path</code> constructor will no longer hold a valid <code>AEAddressDesc</code> if the target application subsequently quits. Sending events to an invalid address will cause a <code>CommandError</code> -600 ("application isn't running") or -609 ("connection is invalid") to be raised.</p>
144
+ <p>Because local applications are identified by process serial number, an existing <code>Application</code> object created using the <code>by_path</code> constructor will no longer hold a valid <code>AEAddressDesc</code> if the target application subsequently quits. Sending events to an invalid address will cause a <code>EventError</code> -600 ("application isn't running") or -609 ("connection is invalid") to be raised.</p>
145
145
 
146
146
  <p>The <code>process_exists_for_path?</code> class method can be used to check if a local application is running or not, given its full path.</p>
147
147
 
@@ -158,8 +158,6 @@ KAE::TypeProcessSerialNumber</code></pre>
158
158
  <a href="04_references.html">Previous</a> &bull;
159
159
  <a href="index.html">Up</a> &bull;
160
160
  <a href="06_buildingandsendingevents.html">Next</a>
161
-
162
- <span>&copy; 2006-2008 HAS</span>
163
161
  </div>
164
162
 
165
163
  </body>