rb-appscript 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +59 -0
- data/LICENSE +65 -0
- data/README +1 -1
- data/TODO +13 -13
- data/doc/aem-manual/04_references.html +13 -13
- data/doc/aem-manual/05_targettingapplications.html +7 -5
- data/doc/aem-manual/06_buildingandsendingevents.html +1 -1
- data/doc/aem-manual/08_examples.html +6 -6
- data/doc/aem-manual/index.html +3 -4
- data/doc/appscript-manual/02_aboutappscripting.html +2 -10
- data/doc/appscript-manual/04_gettinghelp.html +32 -18
- data/doc/appscript-manual/05_keywordconversion.html +7 -7
- data/doc/appscript-manual/06_classesandenums.html +2 -21
- data/doc/appscript-manual/07_applicationobjects.html +11 -2
- data/doc/appscript-manual/08_realvsgenericreferences.html +1 -1
- data/doc/appscript-manual/09_referenceforms.html +13 -13
- data/doc/appscript-manual/10_referenceexamples.html +7 -7
- data/doc/appscript-manual/11_applicationcommands.html +30 -28
- data/doc/appscript-manual/13_performanceissues.html +3 -3
- data/doc/appscript-manual/{15_notes.html → 14_notes.html} +18 -13
- data/doc/appscript-manual/full.css +1 -2
- data/doc/appscript-manual/index.html +3 -4
- data/doc/index.html +2 -1
- data/doc/mactypes-manual/index.html +23 -13
- data/doc/osax-manual/index.html +27 -5
- data/rb-appscript.gemspec +1 -1
- data/sample/AB_list_people_with_emails.rb +2 -1
- data/sample/Add_iCal_event.rb +18 -0
- data/sample/Export_Address_Book_phone_numbers.rb +56 -0
- data/sample/Hello_world.rb +9 -1
- data/sample/Select_all_HTML_files.rb +4 -2
- data/sample/iTunes_top40_to_html.rb +7 -4
- data/src/lib/_aem/aemreference.rb +50 -51
- data/src/lib/_aem/codecs.rb +148 -178
- data/src/lib/_aem/connect.rb +0 -2
- data/src/lib/_aem/findapp.rb +1 -1
- data/src/lib/_aem/mactypes.rb +2 -9
- data/src/lib/_aem/send.rb +2 -2
- data/src/lib/_appscript/defaultterminology.rb +2 -2
- data/src/lib/_appscript/referencerenderer.rb +119 -14
- data/src/lib/_appscript/reservedkeywords.rb +5 -0
- data/src/lib/_appscript/safeobject.rb +190 -0
- data/src/lib/_appscript/terminology.rb +195 -90
- data/src/lib/aem.rb +8 -9
- data/src/lib/appscript.rb +175 -159
- data/src/lib/osax.rb +65 -29
- data/src/rbae.c +42 -2
- data/test/test_aemreference.rb +3 -3
- data/test/test_appscriptcommands.rb +135 -0
- data/test/test_appscriptreference.rb +10 -8
- data/test/test_mactypes.rb +7 -1
- data/test/test_osax.rb +57 -0
- data/test/testall.sh +2 -1
- metadata +10 -9
- data/doc/aem-manual/09_notes.html +0 -41
- data/doc/appscript-manual/14_problemapps.html +0 -192
- data/misc/adobeunittypes.rb +0 -14
- data/misc/dump.rb +0 -72
- data/rb-appscript-0.2.0.gem +0 -0
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
<!-- top navigation -->
|
16
16
|
<div class="navbar">
|
17
|
-
<a href="01_introduction.html">Next</a>
|
17
|
+
<a href="../index.html">Up</a> | <a href="01_introduction.html">Next</a>
|
18
18
|
|
19
19
|
</div>
|
20
20
|
|
@@ -33,13 +33,12 @@
|
|
33
33
|
<li><a href="11_applicationcommands.html">Application Commands</a></li>
|
34
34
|
<li><a href="12_commandexamples.html">Command Examples</a></li>
|
35
35
|
<li><a href="13_performanceissues.html">Performance Issues</a></li>
|
36
|
-
<li><a href="
|
37
|
-
<li><a href="15_notes.html">Notes</a></li>
|
36
|
+
<li><a href="14_notes.html">Notes</a></li>
|
38
37
|
</ol></div>
|
39
38
|
|
40
39
|
<!-- bottom navigation -->
|
41
40
|
<div class="navbar">
|
42
|
-
<a href="01_introduction.html">Next</a>
|
41
|
+
<a href="../index.html">Up</a> | <a href="01_introduction.html">Next</a>
|
43
42
|
|
44
43
|
</div>
|
45
44
|
|
data/doc/index.html
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
<!-- top navigation -->
|
16
16
|
<div class="navbar">
|
17
|
-
<a href="index.html">Up</a>
|
17
|
+
<a href="../index.html">Up</a>
|
18
18
|
|
19
19
|
</div>
|
20
20
|
|
@@ -22,7 +22,7 @@
|
|
22
22
|
<div id="content">
|
23
23
|
<h2>What is mactypes?</h2>
|
24
24
|
|
25
|
-
<p>The mactypes module provides user-friendly wrappers for OS X Alias and
|
25
|
+
<p>The mactypes module provides user-friendly wrappers for OS X Alias and FileURL objects, commonly used by scriptable applications to identify filesystem objects and locations, and for unit type values used by some applications to represent lengths, etc. It is automatically imported when requiring appscript, aem or osax.</p>
|
26
26
|
|
27
27
|
<p class="hilitebox">Note that most scriptable applications do not use or understand POSIX paths, and while the Apple Event Manager does provide some built-in coercions for converting between path strings and alias/file objects, these work with HFS paths only. Therefore, when specifying files and folders to scriptable applications, use <code>MacTypes::Alias</code> and <code>MacTypes::FileURL</code> objects - not path strings - unless otherwise indicated.</p>
|
28
28
|
|
@@ -86,8 +86,7 @@ Appscript.app('TextEdit').open(f)
|
|
86
86
|
|
87
87
|
<h3>Notes</h3>
|
88
88
|
|
89
|
-
<p>
|
90
|
-
|
89
|
+
<p>Comparing an <code>Alias</code> object against a <code>FileURL</code> object always returns false, even if both point to the same location.</p>
|
91
90
|
|
92
91
|
|
93
92
|
<h2><code>MacTypes::FileURL</code></h2>
|
@@ -162,7 +161,7 @@ Appscript.app('older app').documents[1].save(:in => fs_spec)</code></pre>
|
|
162
161
|
|
163
162
|
<p>When used in an application command, a <code>FileURL</code> object returned by appscript will always pack into the same <code>TypeFSRef</code>, <code>TypeFileURL</code> or <code>TypeFSS</code> AEDesc it was created from. A <code>FileURL</code> object returned by <code>FileURL.path</code>, <code>Alias#to_file_url</code> or <code>FileURL#to_file_url</code> will always pack into an AEDesc of <code>TypeFileURL</code>.</p>
|
164
163
|
|
165
|
-
<p>
|
164
|
+
<p>When comparing <code>FileURL</code> objects for equality, be aware that <code>FileURL#==</code> always performs case-sensitive comparisons, regardless of how the underlying filesystem handles case-[in]sensitivity.</p>
|
166
165
|
|
167
166
|
<p>Note that AEDescs of <code>TypeFSRef</code> can represent existing filesystem locations only. AEDescs of <code>TypeFileURL</code> can represent both existing and non-existing locations. AEDescs of <code>TypeFSS</code> (FSSpecs) are deprecated on Mac OS X due to lack of proper Unicode and long filename support, and are retained for backwards compatibility with older applications only.</p>
|
168
167
|
|
@@ -209,22 +208,33 @@ MacTypes::Alias.path('/some/non/existent/location')
|
|
209
208
|
|
210
209
|
to_s -- returns the measurement as a string, e.g. "3.5 centimeters"</code></pre>
|
211
210
|
|
212
|
-
<p>
|
213
|
-
|
214
|
-
<pre><code>MacTypes::Units.new(14, :inches)</code></pre>
|
215
|
-
|
216
|
-
<p>can also be written as:</p>
|
211
|
+
<p>The following unit types are defined as standard:</p>
|
217
212
|
|
218
|
-
<pre><code
|
213
|
+
<pre><code>:centimeters :cubic_inches
|
214
|
+
:meters :cubic_feet
|
215
|
+
:kilometers :cubic_yards
|
216
|
+
:inches
|
217
|
+
:feet :liters
|
218
|
+
:yards :quarts
|
219
|
+
:miles :gallons
|
220
|
+
|
221
|
+
:square_meters :grams
|
222
|
+
:square_kilometers :kilograms
|
223
|
+
:square_feet :ounces
|
224
|
+
:square_yards :pounds
|
225
|
+
:square_miles
|
226
|
+
:degrees_Celsius
|
227
|
+
:cubic_centimeters :degrees_Fahrenheit
|
228
|
+
:cubic_meters :degrees_Kelvin</code></pre>
|
219
229
|
|
220
|
-
<p>
|
230
|
+
<p>Additional application-specific unit types can be added if needed.</p>
|
221
231
|
|
222
232
|
|
223
233
|
</div>
|
224
234
|
|
225
235
|
<!-- bottom navigation -->
|
226
236
|
<div class="navbar">
|
227
|
-
<a href="index.html">Up</a>
|
237
|
+
<a href="../index.html">Up</a>
|
228
238
|
|
229
239
|
</div>
|
230
240
|
|
data/doc/osax-manual/index.html
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
<!-- top navigation -->
|
16
16
|
<div class="navbar">
|
17
|
-
<a href="index.html">Up</a>
|
17
|
+
<a href="../index.html">Up</a>
|
18
18
|
</div>
|
19
19
|
|
20
20
|
<!-- content -->
|
@@ -54,11 +54,21 @@ p OSAX.scripting_additions
|
|
54
54
|
|
55
55
|
<h2><code>OSAX.osax</code></h2>
|
56
56
|
|
57
|
-
<p>The <code>osax</code> function provides a convenient shortcut for creating new <code>ScriptingAddition</code> instances
|
57
|
+
<p>The <code>osax</code> function provides a convenient shortcut for creating new <code>ScriptingAddition</code> instances.</p>
|
58
|
+
|
59
|
+
<pre><code>osax(name=nil, app_name=nil) -- convenience method for
|
60
|
+
creating a new ScriptingAddition instance
|
61
|
+
name : String | nil -- scripting addition's name
|
62
|
+
(nil = "StandardAdditions")
|
63
|
+
app_name : String | nil -- target application's name/path, or nil
|
64
|
+
for current application
|
65
|
+
Result : ScriptingAddition</code></pre>
|
66
|
+
|
67
|
+
<p>For example:</p>
|
58
68
|
|
59
69
|
<pre><code>require "osax"
|
60
70
|
|
61
|
-
sa = OSAX.osax
|
71
|
+
sa = OSAX.osax
|
62
72
|
|
63
73
|
p sa
|
64
74
|
# Result: #<OSAX::ScriptingAddition
|
@@ -75,6 +85,18 @@ p sa
|
|
75
85
|
|
76
86
|
<p>To specify applications by other means (e.g. URL), create a <code>ScriptingAddition</code> object first, then call the appropriate <code>by...</code> method.</p>
|
77
87
|
|
88
|
+
<p>For convenience, if both arguments are nil then a <code>ScriptingAddition</code> object for StandardAdditions is created and returned. This object is also cached internally for efficiency and returned as-is in subsequent calls; thus, for example:</p>
|
89
|
+
|
90
|
+
<pre><code>sa = osax
|
91
|
+
sa.some_command
|
92
|
+
sa.another_command</code></pre>
|
93
|
+
|
94
|
+
<p>could also be written as:</p>
|
95
|
+
|
96
|
+
<pre><code>osax.some_command
|
97
|
+
osax.another_command</code></pre>
|
98
|
+
|
99
|
+
<p>without the additional overhead of creating a new ScriptingAddition object each time.</p>
|
78
100
|
|
79
101
|
|
80
102
|
|
@@ -121,7 +143,7 @@ p sa
|
|
121
143
|
|
122
144
|
# Create a new ScriptingAddition object:
|
123
145
|
|
124
|
-
sa = OSAX.osax
|
146
|
+
sa = OSAX.osax
|
125
147
|
|
126
148
|
|
127
149
|
# List all available commands:
|
@@ -160,7 +182,7 @@ p sa.display_dialog("Ruby says hello!",
|
|
160
182
|
|
161
183
|
<!-- bottom navigation -->
|
162
184
|
<div class="navbar">
|
163
|
-
<a href="index.html">Up</a>
|
185
|
+
<a href="../index.html">Up</a>
|
164
186
|
</div>
|
165
187
|
|
166
188
|
<!--footer-->
|
data/rb-appscript.gemspec
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/local/bin/ruby
|
2
|
+
|
3
|
+
require 'appscript'
|
4
|
+
include Appscript
|
5
|
+
|
6
|
+
# Add an event to Home calendar that runs from 7am to 9 am tomorrow
|
7
|
+
|
8
|
+
calendar_name = 'Home'
|
9
|
+
t = Time.now + 60 * 60 * 24
|
10
|
+
start = Time.local(t.year, t.month, t.day, 7)
|
11
|
+
end_ = start + 60 * 60 * 2
|
12
|
+
summary = 'First pants, then shoes.'
|
13
|
+
|
14
|
+
app('iCal').calendars[calendar_name].events.end.make(
|
15
|
+
:new => :event, :with_properties => {
|
16
|
+
:start_date => start,
|
17
|
+
:end_date => end_,
|
18
|
+
:summary => summary})
|
@@ -0,0 +1,56 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Exports phone numbers from Address Book.
|
4
|
+
|
5
|
+
require "osax"
|
6
|
+
include Appscript, OSAX
|
7
|
+
|
8
|
+
# create Application object for Address Book
|
9
|
+
AB = app("Address Book")
|
10
|
+
|
11
|
+
# prompt user for name of Address Book group to export from
|
12
|
+
DefaultChoice = ["<All>"]
|
13
|
+
|
14
|
+
groups = DefaultChoice + AB.groups.name.get
|
15
|
+
choice = osax.choose_from_list(groups, :default_items => DefaultChoice)
|
16
|
+
if choice == false # user cancelled
|
17
|
+
exit
|
18
|
+
elsif choice == DefaultChoice
|
19
|
+
ref = AB
|
20
|
+
else
|
21
|
+
ref = AB.groups[choice[0]]
|
22
|
+
end
|
23
|
+
|
24
|
+
# build a reference identifying those people with one or more phone numbers
|
25
|
+
p = ref.people[its.phones.ne([])]
|
26
|
+
|
27
|
+
# get first and last names for those people, replacing any :missing_value
|
28
|
+
# entries with empty strings
|
29
|
+
last_names = p.last_name.get.collect { |val| val.is_a?(String) ? val : "" }
|
30
|
+
first_names = p.first_name.get.collect { |val| val.is_a?(String) ? val : "" }
|
31
|
+
|
32
|
+
# get lists of phone numbers and locations for those people
|
33
|
+
locations = p.phones.label.get
|
34
|
+
numbers = p.phones.value.get
|
35
|
+
|
36
|
+
# build an array containing each person's details:
|
37
|
+
# [[last name, first name, locations, numbers], ...]
|
38
|
+
people = last_names.zip(first_names, locations, numbers)
|
39
|
+
|
40
|
+
# sort array by last and first name
|
41
|
+
people.sort! do |a, b|
|
42
|
+
a[0,2].collect { |s| s.downcase } <=> b[0,2].collect { |s| s.downcase }
|
43
|
+
end
|
44
|
+
|
45
|
+
# print table
|
46
|
+
puts " #{'_' * 70} "
|
47
|
+
people.each do |last_name, first_name, locations, numbers|
|
48
|
+
name = [last_name, first_name].delete_if { |s| s == "" }.join(', ')
|
49
|
+
puts "|#{' ' * 70}|"
|
50
|
+
# print each phone number in turn
|
51
|
+
numbers.zip(locations).each do |number, location|
|
52
|
+
puts "| #{name.ljust(32)} #{number.ljust(20)} (#{(location + ')').ljust(13)} |"
|
53
|
+
name = ""
|
54
|
+
end
|
55
|
+
puts "|#{'_' * 70}|"
|
56
|
+
end
|
data/sample/Hello_world.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
# Hello world in TextEdit
|
3
|
+
# 1. "Hello world" in TextEdit:
|
4
4
|
|
5
5
|
require "appscript"
|
6
6
|
include Appscript
|
@@ -8,3 +8,11 @@ include Appscript
|
|
8
8
|
te = app('TextEdit')
|
9
9
|
te.activate
|
10
10
|
te.documents.end.make(:new => :document, :with_properties => {:text => "Hello World!\n"})
|
11
|
+
|
12
|
+
|
13
|
+
# 2. "Hello world" using StandardAdditions:
|
14
|
+
|
15
|
+
require "osax"
|
16
|
+
include OSAX
|
17
|
+
|
18
|
+
osax.display_dialog("Hello World")
|
@@ -5,5 +5,7 @@
|
|
5
5
|
require "appscript"
|
6
6
|
include Appscript
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
finder = app('Finder')
|
9
|
+
finder.activate
|
10
|
+
folder = finder.Finder_windows[1].target.get
|
11
|
+
folder.files[its.name_extension.is_in(['htm', 'html'])].select
|
@@ -40,7 +40,7 @@ END
|
|
40
40
|
|
41
41
|
# Choose the file to write
|
42
42
|
sa = OSAX.osax('StandardAdditions')
|
43
|
-
out_file = sa.choose_file_name(:default_name=>'My
|
43
|
+
out_file = sa.choose_file_name(:default_name=>'My-iTunes-Top-40.html')
|
44
44
|
|
45
45
|
# Get the played count, name and album for every track in iTunes
|
46
46
|
tracks = app('iTunes').library_playlists[1].tracks
|
@@ -58,8 +58,11 @@ tmpl.prettyprint = true
|
|
58
58
|
File.open(out_file.to_s, 'w') { |f| tmpl.expand(f, data) }
|
59
59
|
|
60
60
|
# Open file in Safari for viewing
|
61
|
-
safari = app('Safari')
|
62
|
-
safari.activate
|
63
|
-
safari.open(out_file)
|
61
|
+
# safari = app('Safari')
|
62
|
+
# safari.activate
|
63
|
+
# safari.open(out_file)
|
64
|
+
|
65
|
+
# Open file in default web browser for viewing
|
66
|
+
sa.open_location(out_file.url)
|
64
67
|
|
65
68
|
|
@@ -71,7 +71,7 @@ module AEMReference
|
|
71
71
|
@result = []
|
72
72
|
end
|
73
73
|
|
74
|
-
def
|
74
|
+
def send(name, *args)
|
75
75
|
self.result.push([name] + args)
|
76
76
|
return self
|
77
77
|
end
|
@@ -182,8 +182,7 @@ module AEMReference
|
|
182
182
|
end
|
183
183
|
|
184
184
|
def AEM_resolve(obj)
|
185
|
-
return @_container.AEM_resolve(obj).send(@_keyname)
|
186
|
-
end
|
185
|
+
return @_container.AEM_resolve(obj).send(@_keyname) end
|
187
186
|
end
|
188
187
|
|
189
188
|
|
@@ -298,33 +297,33 @@ module AEMReference
|
|
298
297
|
# property represents a one-to-one relationship, e.g. textedit.documents[1].text.end is valid
|
299
298
|
|
300
299
|
def start
|
301
|
-
return InsertionSpecifier.new(self, Beginning,
|
300
|
+
return InsertionSpecifier.new(self, Beginning, :start)
|
302
301
|
end
|
303
302
|
|
304
303
|
def end
|
305
|
-
return InsertionSpecifier.new(self, End,
|
304
|
+
return InsertionSpecifier.new(self, End, :end)
|
306
305
|
end
|
307
306
|
|
308
307
|
def before
|
309
|
-
return InsertionSpecifier.new(self, Before,
|
308
|
+
return InsertionSpecifier.new(self, Before, :before)
|
310
309
|
end
|
311
310
|
|
312
311
|
def after
|
313
|
-
return InsertionSpecifier.new(self, After,
|
312
|
+
return InsertionSpecifier.new(self, After, :after)
|
314
313
|
end
|
315
314
|
|
316
315
|
# Property and element references can be used on any type of object reference:
|
317
316
|
|
318
|
-
def property(
|
319
|
-
return Property.new(KAE::CProperty, self,
|
317
|
+
def property(code)
|
318
|
+
return Property.new(KAE::CProperty, self, code)
|
320
319
|
end
|
321
320
|
|
322
|
-
def
|
321
|
+
def user_property(name)
|
323
322
|
return UserProperty.new(KAE::CProperty, self, name)
|
324
323
|
end
|
325
324
|
|
326
|
-
def elements(
|
327
|
-
return AllElements.new(
|
325
|
+
def elements(code)
|
326
|
+
return AllElements.new(code, self)
|
328
327
|
end
|
329
328
|
|
330
329
|
# Relative position references
|
@@ -333,12 +332,12 @@ module AEMReference
|
|
333
332
|
# simplifies the class structure a bit. As with all reference forms, it's mostly left to the client to
|
334
333
|
# ensure the references they construct can be understood by the target application.
|
335
334
|
|
336
|
-
def previous(
|
337
|
-
return ElementByRelativePosition.new(
|
335
|
+
def previous(code)
|
336
|
+
return ElementByRelativePosition.new(code, self, Previous, :previous)
|
338
337
|
end
|
339
338
|
|
340
|
-
def next(
|
341
|
-
return ElementByRelativePosition.new(
|
339
|
+
def next(code)
|
340
|
+
return ElementByRelativePosition.new(code, self, Next, :next)
|
342
341
|
end
|
343
342
|
end
|
344
343
|
|
@@ -352,7 +351,7 @@ module AEMReference
|
|
352
351
|
|
353
352
|
# Syntax: ref.property(code)
|
354
353
|
|
355
|
-
By =
|
354
|
+
By = :property
|
356
355
|
KeyForm = AEMReference.pack_enum(KAE::FormPropertyID)
|
357
356
|
|
358
357
|
def _pack_key(codecs)
|
@@ -360,7 +359,7 @@ module AEMReference
|
|
360
359
|
end
|
361
360
|
|
362
361
|
def AEM_resolve(obj)
|
363
|
-
return @_container.AEM_resolve(obj).property
|
362
|
+
return @_container.AEM_resolve(obj).send(:property, @_key)
|
364
363
|
end
|
365
364
|
end
|
366
365
|
|
@@ -371,17 +370,17 @@ module AEMReference
|
|
371
370
|
# Scriptable applications shouldn't use this reference form, but OSA script applets can.
|
372
371
|
# Note that OSA languages may have additional rules regarding case sensitivity/conversion.
|
373
372
|
|
374
|
-
# Syntax: ref.
|
373
|
+
# Syntax: ref.user_property(name)
|
375
374
|
|
376
|
-
By =
|
377
|
-
KeyForm = AEMReference.pack_enum(
|
375
|
+
By = :user_property
|
376
|
+
KeyForm = AEMReference.pack_enum(KAE::FormUserPropertyID)
|
378
377
|
|
379
378
|
def _pack_key(codecs)
|
380
379
|
return codecs.pack(@_key).coerce(KAE::TypeChar)
|
381
380
|
end
|
382
381
|
|
383
382
|
def AEM_resolve(obj)
|
384
|
-
return @_container.AEM_resolve(obj).
|
383
|
+
return @_container.AEM_resolve(obj).send(:user_property, @_key)
|
385
384
|
end
|
386
385
|
end
|
387
386
|
|
@@ -417,7 +416,7 @@ module AEMReference
|
|
417
416
|
|
418
417
|
# Syntax: elements_ref.by_name(string)
|
419
418
|
|
420
|
-
By =
|
419
|
+
By = :by_name
|
421
420
|
KeyForm = AEMReference.pack_enum(KAE::FormName)
|
422
421
|
end
|
423
422
|
|
@@ -429,7 +428,7 @@ module AEMReference
|
|
429
428
|
|
430
429
|
# Note that a few apps (e.g. Finder) may allow other values as well (e.g. Aliases/FSRefs)
|
431
430
|
|
432
|
-
By =
|
431
|
+
By = :by_index
|
433
432
|
KeyForm = AEMReference.pack_enum(KAE::FormAbsolutePosition)
|
434
433
|
end
|
435
434
|
|
@@ -439,7 +438,7 @@ module AEMReference
|
|
439
438
|
|
440
439
|
# Syntax: elements_ref.by_id(anything)
|
441
440
|
|
442
|
-
By =
|
441
|
+
By = :by_id
|
443
442
|
KeyForm = AEMReference.pack_enum(KAE::FormUniqueID)
|
444
443
|
end
|
445
444
|
|
@@ -511,19 +510,19 @@ module AEMReference
|
|
511
510
|
Any = AEMReference.pack_absolute_ordinal(KAE::KAEAny)
|
512
511
|
|
513
512
|
def first
|
514
|
-
return ElementByOrdinal.new(@AEM_want, self, First,
|
513
|
+
return ElementByOrdinal.new(@AEM_want, self, First, :first)
|
515
514
|
end
|
516
515
|
|
517
516
|
def middle
|
518
|
-
return ElementByOrdinal.new(@AEM_want, self, Middle,
|
517
|
+
return ElementByOrdinal.new(@AEM_want, self, Middle, :middle)
|
519
518
|
end
|
520
519
|
|
521
520
|
def last
|
522
|
-
return ElementByOrdinal.new(@AEM_want, self, Last,
|
521
|
+
return ElementByOrdinal.new(@AEM_want, self, Last, :last)
|
523
522
|
end
|
524
523
|
|
525
524
|
def any
|
526
|
-
return ElementByOrdinal.new(@AEM_want, self, Any,
|
525
|
+
return ElementByOrdinal.new(@AEM_want, self, Any, :any)
|
527
526
|
end
|
528
527
|
|
529
528
|
def by_name(name)
|
@@ -542,8 +541,8 @@ module AEMReference
|
|
542
541
|
return ElementsByRange.new(@AEM_want, self, [start, stop])
|
543
542
|
end
|
544
543
|
|
545
|
-
def by_filter(
|
546
|
-
return ElementsByFilter.new(@AEM_want, self,
|
544
|
+
def by_filter(test)
|
545
|
+
return ElementsByFilter.new(@AEM_want, self, test)
|
547
546
|
end
|
548
547
|
end
|
549
548
|
|
@@ -581,7 +580,7 @@ module AEMReference
|
|
581
580
|
end
|
582
581
|
|
583
582
|
def AEM_resolve(obj)
|
584
|
-
return @_container.AEM_resolve(obj).by_range
|
583
|
+
return @_container.AEM_resolve(obj).send(:by_range, *@_key)
|
585
584
|
end
|
586
585
|
end
|
587
586
|
|
@@ -617,7 +616,7 @@ module AEMReference
|
|
617
616
|
end
|
618
617
|
|
619
618
|
def AEM_resolve(obj)
|
620
|
-
return @_container.AEM_resolve(obj).by_filter
|
619
|
+
return @_container.AEM_resolve(obj).send(:by_filter, @_key)
|
621
620
|
end
|
622
621
|
end
|
623
622
|
|
@@ -721,7 +720,7 @@ module AEMReference
|
|
721
720
|
end
|
722
721
|
|
723
722
|
def AEM_resolve(obj)
|
724
|
-
return @_container.AEM_resolve(obj).elements
|
723
|
+
return @_container.AEM_resolve(obj).send(:elements, @AEM_want)
|
725
724
|
end
|
726
725
|
end
|
727
726
|
|
@@ -819,22 +818,22 @@ module AEMReference
|
|
819
818
|
|
820
819
|
|
821
820
|
class GreaterThan < ComparisonTest
|
822
|
-
Name =
|
821
|
+
Name = :gt
|
823
822
|
Operator = AEMReference.pack_enum(KAE::KAEGreaterThan)
|
824
823
|
end
|
825
824
|
|
826
825
|
class GreaterOrEquals < ComparisonTest
|
827
|
-
Name =
|
826
|
+
Name = :ge
|
828
827
|
Operator = AEMReference.pack_enum(KAE::KAEGreaterThanEquals)
|
829
828
|
end
|
830
829
|
|
831
830
|
class Equals < ComparisonTest
|
832
|
-
Name =
|
831
|
+
Name = :eq
|
833
832
|
Operator = AEMReference.pack_enum(KAE::KAEEquals)
|
834
833
|
end
|
835
834
|
|
836
835
|
class NotEquals < Equals
|
837
|
-
Name =
|
836
|
+
Name = :ne
|
838
837
|
OperatorNOT = AEMReference.pack_enum(KAE::KAENOT)
|
839
838
|
|
840
839
|
def AEM_pack_self(codecs)
|
@@ -843,32 +842,32 @@ module AEMReference
|
|
843
842
|
end
|
844
843
|
|
845
844
|
class LessThan < ComparisonTest
|
846
|
-
Name =
|
845
|
+
Name = :lt
|
847
846
|
Operator = AEMReference.pack_enum(KAE::KAELessThan)
|
848
847
|
end
|
849
848
|
|
850
849
|
class LessOrEquals < ComparisonTest
|
851
|
-
Name =
|
850
|
+
Name = :le
|
852
851
|
Operator = AEMReference.pack_enum(KAE::KAELessThanEquals)
|
853
852
|
end
|
854
853
|
|
855
854
|
class StartsWith < ComparisonTest
|
856
|
-
Name =
|
855
|
+
Name = :starts_with
|
857
856
|
Operator = AEMReference.pack_enum(KAE::KAEBeginsWith)
|
858
857
|
end
|
859
858
|
|
860
859
|
class EndsWith < ComparisonTest
|
861
|
-
Name =
|
860
|
+
Name = :ends_with
|
862
861
|
Operator = AEMReference.pack_enum(KAE::KAEEndsWith)
|
863
862
|
end
|
864
863
|
|
865
864
|
class Contains < ComparisonTest
|
866
|
-
Name =
|
865
|
+
Name = :contains
|
867
866
|
Operator = AEMReference.pack_enum(KAE::KAEContains)
|
868
867
|
end
|
869
868
|
|
870
869
|
class IsIn < Contains
|
871
|
-
Name =
|
870
|
+
Name = :is_in
|
872
871
|
|
873
872
|
def AEM_pack_self(codecs)
|
874
873
|
return AEMReference.pack_list_as(KAE::TypeCompDescriptor, [
|
@@ -911,24 +910,24 @@ module AEMReference
|
|
911
910
|
|
912
911
|
class AND < LogicalTest
|
913
912
|
Operator = AEMReference.pack_enum(KAE::KAEAND)
|
914
|
-
Name =
|
913
|
+
Name = :and
|
915
914
|
end
|
916
915
|
|
917
916
|
class OR < LogicalTest
|
918
917
|
Operator = AEMReference.pack_enum(KAE::KAEOR)
|
919
|
-
Name =
|
918
|
+
Name = :or
|
920
919
|
end
|
921
920
|
|
922
921
|
class NOT < LogicalTest
|
923
922
|
Operator = AEMReference.pack_enum(KAE::KAENOT)
|
924
|
-
Name =
|
923
|
+
Name = :not
|
925
924
|
|
926
925
|
def to_s
|
927
926
|
return "#{@_operands[0].inspect}.not"
|
928
927
|
end
|
929
928
|
|
930
929
|
def AEM_resolve(obj)
|
931
|
-
return @_operands[0].AEM_resolve(obj).not
|
930
|
+
return @_operands[0].AEM_resolve(obj).send(:not)
|
932
931
|
end
|
933
932
|
end
|
934
933
|
|
@@ -971,7 +970,7 @@ module AEMReference
|
|
971
970
|
|
972
971
|
# Syntax: app
|
973
972
|
|
974
|
-
Name =
|
973
|
+
Name = :app
|
975
974
|
Type = AE::AEDesc.new(KAE::TypeNull, '')
|
976
975
|
end
|
977
976
|
|
@@ -981,7 +980,7 @@ module AEMReference
|
|
981
980
|
|
982
981
|
# Syntax: con
|
983
982
|
|
984
|
-
Name =
|
983
|
+
Name = :con
|
985
984
|
Type = AE::AEDesc.new(KAE::TypeCurrentContainer, '')
|
986
985
|
end
|
987
986
|
|
@@ -991,7 +990,7 @@ module AEMReference
|
|
991
990
|
|
992
991
|
# Syntax: its
|
993
992
|
|
994
|
-
Name =
|
993
|
+
Name = :its
|
995
994
|
Type = AE::AEDesc.new(KAE::TypeObjectBeingExamined, '')
|
996
995
|
end
|
997
996
|
|