rb-scpt 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +2 -0
- data/.gitignore +6 -0
- data/Manifest.txt +96 -0
- data/Rakefile +10 -23
- data/{src → ext/ae}/SendThreadSafe.c +1 -1
- data/{src/rbae.c → ext/ae/ae.c} +7 -4
- data/{extconf.rb → ext/ae/extconf.rb} +6 -33
- data/{src/lib → lib}/_aem/aemreference.rb +2 -1
- data/{src/lib → lib}/_aem/codecs.rb +4 -4
- data/{src/lib → lib}/_aem/connect.rb +6 -6
- data/{src/lib → lib}/_aem/findapp.rb +4 -4
- data/{src/lib → lib}/_aem/send.rb +10 -12
- data/{src/lib → lib}/_appscript/defaultterminology.rb +3 -3
- data/{src/lib → lib}/_appscript/referencerenderer.rb +2 -2
- data/{src/lib → lib}/_appscript/safeobject.rb +4 -4
- data/{src/lib → lib}/_appscript/terminology.rb +4 -4
- data/{src/lib → lib}/aem.rb +5 -5
- data/{src/lib → lib}/rb-scpt.rb +0 -2
- data/lib/version.rb +3 -0
- data/rb-scpt.gemspec +15 -10
- data/test/test_aemreference.rb +3 -3
- data/test/test_appscriptcommands.rb +16 -18
- data/test/test_appscriptreference.rb +1 -1
- data/test/test_codecs.rb +13 -8
- data/test/test_findapp.rb +9 -9
- data/test/test_mactypes.rb +5 -3
- data/test/test_osax.rb +25 -13
- data.tar.gz.sig +0 -0
- metadata +62 -41
- metadata.gz.sig +0 -0
- data/Makefile +0 -327
- data/bin/rb-scpt-1.0.0.gem +0 -0
- data/bin/rb-scpt-1.0.1.gem +0 -0
- data/rb-scpt-1.0.2.gem +0 -0
- /data/{src → ext/ae}/SendThreadSafe.h +0 -0
- /data/{src/lib → lib}/_aem/encodingsupport.rb +0 -0
- /data/{src/lib → lib}/_aem/mactypes.rb +0 -0
- /data/{src/lib → lib}/_aem/typewrappers.rb +0 -0
- /data/{src/lib → lib}/_appscript/reservedkeywords.rb +0 -0
- /data/{src/lib → lib}/kae.rb +0 -0
- /data/{src/lib → lib}/osax.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c86266e32295b553a490fc58c5b22a62a1bca4b2df975e46d7909c3f72bc901
|
4
|
+
data.tar.gz: 61347116bed121e3bc825768dbb5420ab878f1476d3fba6f50f3a8517977c9a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d8639d9d502df996be3a2ff8332e6f48696cd3e95726efd3c6cd3260451313b3c89eb484fd2a6a879d4bef62fe08fbdd95107112c0da000dcb733ed0d611063
|
7
|
+
data.tar.gz: 707bed2d8d0f09b0814ff9a66295f5041836ac66f15dfb9f06ccab9bc24a840ed271f81d5a3c7e928e3ebb7fa9246d3f54a978a75e70b532eed532e47c90f6a6
|
checksums.yaml.gz.sig
ADDED
data/.gitignore
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
.gitignore
|
2
|
+
CHANGES
|
3
|
+
Manifest.txt
|
4
|
+
README.md
|
5
|
+
Rakefile
|
6
|
+
doc/aem-manual/01_introduction.html
|
7
|
+
doc/aem-manual/02_apioverview.html
|
8
|
+
doc/aem-manual/03_packingandunpackingdata.html
|
9
|
+
doc/aem-manual/04_references.html
|
10
|
+
doc/aem-manual/05_targetingapplications.html
|
11
|
+
doc/aem-manual/06_buildingandsendingevents.html
|
12
|
+
doc/aem-manual/07_findapp.html
|
13
|
+
doc/aem-manual/08_examples.html
|
14
|
+
doc/aem-manual/aemreferenceinheritance.gif
|
15
|
+
doc/aem-manual/index.html
|
16
|
+
doc/appscript-manual/01_introduction.html
|
17
|
+
doc/appscript-manual/02_aboutappscripting.html
|
18
|
+
doc/appscript-manual/03_quicktutorial.html
|
19
|
+
doc/appscript-manual/04_gettinghelp.html
|
20
|
+
doc/appscript-manual/05_keywordconversion.html
|
21
|
+
doc/appscript-manual/06_classesandenums.html
|
22
|
+
doc/appscript-manual/07_applicationobjects.html
|
23
|
+
doc/appscript-manual/08_realvsgenericreferences.html
|
24
|
+
doc/appscript-manual/09_referenceforms.html
|
25
|
+
doc/appscript-manual/10_referenceexamples.html
|
26
|
+
doc/appscript-manual/11_applicationcommands.html
|
27
|
+
doc/appscript-manual/12_commandexamples.html
|
28
|
+
doc/appscript-manual/13_performanceissues.html
|
29
|
+
doc/appscript-manual/14_notes.html
|
30
|
+
doc/appscript-manual/application_architecture.gif
|
31
|
+
doc/appscript-manual/application_architecture2.gif
|
32
|
+
doc/appscript-manual/finder_to_textedit_event.gif
|
33
|
+
doc/appscript-manual/index.html
|
34
|
+
doc/appscript-manual/relationships_example.gif
|
35
|
+
doc/appscript-manual/ruby_to_itunes_event.gif
|
36
|
+
doc/full.css
|
37
|
+
doc/index.html
|
38
|
+
doc/mactypes-manual/01_introduction.html
|
39
|
+
doc/mactypes-manual/02_aliasclass.html
|
40
|
+
doc/mactypes-manual/03_fileurlclass.html
|
41
|
+
doc/mactypes-manual/04_unitsclass.html
|
42
|
+
doc/mactypes-manual/index.html
|
43
|
+
doc/osax-manual/01_introduction.html
|
44
|
+
doc/osax-manual/02_interface.html
|
45
|
+
doc/osax-manual/03_examples.html
|
46
|
+
doc/osax-manual/04_notes.html
|
47
|
+
doc/osax-manual/index.html
|
48
|
+
doc/rb-appscript-logo.png
|
49
|
+
ext/ae/ae.c
|
50
|
+
ext/ae/SendThreadSafe.c
|
51
|
+
ext/ae/SendThreadSafe.h
|
52
|
+
ext/ae/extconf.rb
|
53
|
+
lib/_aem/aemreference.rb
|
54
|
+
lib/_aem/codecs.rb
|
55
|
+
lib/_aem/connect.rb
|
56
|
+
lib/_aem/encodingsupport.rb
|
57
|
+
lib/_aem/findapp.rb
|
58
|
+
lib/_aem/mactypes.rb
|
59
|
+
lib/_aem/send.rb
|
60
|
+
lib/_aem/typewrappers.rb
|
61
|
+
lib/_appscript/defaultterminology.rb
|
62
|
+
lib/_appscript/referencerenderer.rb
|
63
|
+
lib/_appscript/reservedkeywords.rb
|
64
|
+
lib/_appscript/safeobject.rb
|
65
|
+
lib/_appscript/terminology.rb
|
66
|
+
lib/aem.rb
|
67
|
+
lib/kae.rb
|
68
|
+
lib/osax.rb
|
69
|
+
lib/rb-scpt.rb
|
70
|
+
lib/version.rb
|
71
|
+
rb-scpt.gemspec
|
72
|
+
sample/AB_export_vcard.rb
|
73
|
+
sample/AB_list_people_with_emails.rb
|
74
|
+
sample/Add_iCal_event.rb
|
75
|
+
sample/Create_daily_iCal_todos.rb
|
76
|
+
sample/Export_Address_Book_phone_numbers.rb
|
77
|
+
sample/Hello_world.rb
|
78
|
+
sample/List_iTunes_playlist_names.rb
|
79
|
+
sample/Make_Mail_message.rb
|
80
|
+
sample/Open_file_in_TextEdit.rb
|
81
|
+
sample/Organize_Mail_messages.rb
|
82
|
+
sample/Print_folder_tree.rb
|
83
|
+
sample/Select_all_HTML_files.rb
|
84
|
+
sample/Set_iChat_status.rb
|
85
|
+
sample/Simple_Finder_GUI_Scripting.rb
|
86
|
+
sample/Stagger_Finder_windows.rb
|
87
|
+
sample/TextEdit_demo.rb
|
88
|
+
sample/iTunes_top40_to_html.rb
|
89
|
+
test/README
|
90
|
+
test/test_aemreference.rb
|
91
|
+
test/test_appscriptcommands.rb
|
92
|
+
test/test_appscriptreference.rb
|
93
|
+
test/test_codecs.rb
|
94
|
+
test/test_findapp.rb
|
95
|
+
test/test_mactypes.rb
|
96
|
+
test/test_osax.rb
|
data/Rakefile
CHANGED
@@ -1,31 +1,18 @@
|
|
1
|
-
require "rake/
|
1
|
+
require "rake/extensiontask"
|
2
|
+
Rake::ExtensionTask.new "ae"
|
2
3
|
|
3
4
|
task :default => :test
|
4
5
|
|
5
|
-
task :
|
6
|
-
task :test => :build
|
6
|
+
task :test => :compile
|
7
7
|
|
8
|
-
task :
|
9
|
-
|
8
|
+
task :clean do
|
9
|
+
rm_f Dir["**/*~", "*.gem", "**/*.bundle"]
|
10
10
|
end
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
ruby "extconf.rb"
|
16
|
-
end
|
17
|
-
|
18
|
-
deps = %w[SendThreadSafe rbae]
|
19
|
-
|
20
|
-
file "ae.bundle" => deps.map { |dep| "#{dep}.o" }
|
21
|
-
|
22
|
-
deps.each do |dep|
|
23
|
-
file "#{dep}.o" => "src/#{dep}.c"
|
12
|
+
desc "build the gem"
|
13
|
+
task :gem => [:clean, :clobber] do
|
14
|
+
system "gem build"
|
24
15
|
end
|
25
16
|
|
26
|
-
|
27
|
-
|
28
|
-
t.test_files = FileList['test/test_*.rb']
|
29
|
-
t.verbose = true
|
30
|
-
t.loader = :direct
|
31
|
-
end
|
17
|
+
require "minitest/test_task"
|
18
|
+
Minitest::TestTask.create
|
data/{src/rbae.c → ext/ae/ae.c}
RENAMED
@@ -9,7 +9,7 @@
|
|
9
9
|
* - Jordan Breeding (64-bit support patch)
|
10
10
|
*/
|
11
11
|
|
12
|
-
#include "
|
12
|
+
#include "ruby/ruby.h"
|
13
13
|
#include <Carbon/Carbon.h>
|
14
14
|
#include <CoreFoundation/CoreFoundation.h>
|
15
15
|
#include "SendThreadSafe.h"
|
@@ -222,7 +222,8 @@ rbAE_AEDesc_newUnflatten(VALUE class, VALUE data)
|
|
222
222
|
AEDesc desc;
|
223
223
|
|
224
224
|
Check_Type(data, T_STRING);
|
225
|
-
|
225
|
+
|
226
|
+
err = AEUnflattenDescFromBytes(RSTRING_PTR(data), RSTRING_LEN(data), &desc);
|
226
227
|
if (err != noErr) rbAE_raiseMacOSError("Can't create AEDesc.", err);
|
227
228
|
return rbAE_wrapAEDesc(&desc);
|
228
229
|
}
|
@@ -746,8 +747,9 @@ rbAE_GenericEventHandler(const AppleEvent *request, AppleEvent *reply, SRefCon r
|
|
746
747
|
/*******/
|
747
748
|
|
748
749
|
static VALUE
|
749
|
-
rbAE_AEInstallEventHandler(VALUE self, VALUE eventClass, VALUE eventID,
|
750
|
+
rbAE_AEInstallEventHandler(VALUE self, VALUE eventClass, VALUE eventID, VALUE _handler)
|
750
751
|
{
|
752
|
+
SRefCon handler = (SRefCon)_handler;
|
751
753
|
/*
|
752
754
|
* eventClass and eventID must be four-character code strings
|
753
755
|
*
|
@@ -821,8 +823,9 @@ rbAE_GenericCoercionHandler(const AEDesc *fromDesc, DescType toType, SRefCon ref
|
|
821
823
|
/*******/
|
822
824
|
|
823
825
|
static VALUE
|
824
|
-
rbAE_AEInstallCoercionHandler(VALUE self, VALUE fromType, VALUE toType,
|
826
|
+
rbAE_AEInstallCoercionHandler(VALUE self, VALUE fromType, VALUE toType, VALUE _handler)
|
825
827
|
{
|
828
|
+
SRefCon handler = (SRefCon)_handler;
|
826
829
|
/*
|
827
830
|
* fromType and toType must be four-character code strings
|
828
831
|
*
|
@@ -3,19 +3,19 @@
|
|
3
3
|
# Original copyright below:
|
4
4
|
#
|
5
5
|
# Copyright (c) 2006, Apple Computer, Inc. All rights reserved.
|
6
|
-
#
|
6
|
+
#
|
7
7
|
# Redistribution and use in source and binary forms, with or without
|
8
8
|
# modification, are permitted provided that the following conditions
|
9
9
|
# are met:
|
10
10
|
# 1. Redistributions of source code must retain the above copyright
|
11
|
-
# notice, this list of conditions and the following disclaimer.
|
11
|
+
# notice, this list of conditions and the following disclaimer.
|
12
12
|
# 2. Redistributions in binary form must reproduce the above copyright
|
13
13
|
# notice, this list of conditions and the following disclaimer in the
|
14
|
-
# documentation and/or other materials provided with the distribution.
|
14
|
+
# documentation and/or other materials provided with the distribution.
|
15
15
|
# 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
|
16
16
|
# its contributors may be used to endorse or promote products derived
|
17
|
-
# from this software without specific prior written permission.
|
18
|
-
#
|
17
|
+
# from this software without specific prior written permission.
|
18
|
+
#
|
19
19
|
# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
|
20
20
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
21
21
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
@@ -29,35 +29,8 @@
|
|
29
29
|
# POSSIBILITY OF SUCH DAMAGE.
|
30
30
|
|
31
31
|
require 'mkmf'
|
32
|
-
require 'rbconfig'
|
33
32
|
|
34
33
|
$CFLAGS << ' -Wall'
|
35
34
|
$LDFLAGS << ' -framework Carbon -framework ApplicationServices'
|
36
35
|
|
37
|
-
|
38
|
-
# (adapted code from RubyAEOSA - FUJIMOTO Hisakuni <hisa -at- fobj - com>)
|
39
|
-
|
40
|
-
maj, min = RUBY_VERSION.split('.')
|
41
|
-
is_ruby_18 = (maj <= '1' and min.to_i < 9)
|
42
|
-
if is_ruby_18
|
43
|
-
header_path = RbConfig::CONFIG['archdir']
|
44
|
-
else
|
45
|
-
header_path = File.join(RbConfig::CONFIG['rubyhdrdir'], 'ruby')
|
46
|
-
end
|
47
|
-
ruby_h = File.join(header_path, 'ruby.h')
|
48
|
-
intern_h = File.join(header_path, 'intern.h')
|
49
|
-
new_filename_prefix = 'osx_'
|
50
|
-
|
51
|
-
[ ruby_h, intern_h ].each do |src_path|
|
52
|
-
dst_fname = File.join('./src', new_filename_prefix + File.basename(src_path))
|
53
|
-
$stderr.puts "create #{File.expand_path(dst_fname)} ..."
|
54
|
-
File.open(dst_fname, 'w') do |dstfile|
|
55
|
-
IO.foreach(src_path) do |line|
|
56
|
-
line = line.gsub(/\b(?:ruby\/)?intern.h\b/, "#{new_filename_prefix}intern.h")
|
57
|
-
line = line.gsub('#include "defines.h"', '#include "ruby/defines.h"') if not is_ruby_18
|
58
|
-
dstfile.puts line
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
create_makefile('ae', 'src')
|
36
|
+
create_makefile "ae"
|
@@ -72,9 +72,9 @@ class UnitTypeCodecs
|
|
72
72
|
|
73
73
|
def add_types(type_defs)
|
74
74
|
# type_defs is a list of lists, where each sublist is of form:
|
75
|
-
#
|
75
|
+
# [typename, typecode, packproc, unpackproc]
|
76
76
|
# or:
|
77
|
-
#
|
77
|
+
# [typename, typecode]
|
78
78
|
# If optional packproc and unpackproc are omitted, default pack/unpack procs
|
79
79
|
# are used instead; these pack/unpack AEDesc data as a double precision float.
|
80
80
|
type_defs.each do |name, code, packer, unpacker|
|
@@ -191,7 +191,7 @@ class Codecs
|
|
191
191
|
# them into AEDescs of typeUTF8Text. To force the old-style behaviour where
|
192
192
|
# strings are treated as byte strings containing UTF-8 data, call:
|
193
193
|
#
|
194
|
-
#
|
194
|
+
# some_application.AS_app_data.use_ascii_8bit_strings
|
195
195
|
#
|
196
196
|
# This will cause Strings to use the binary ASCII-8BIT encoding; as in Ruby 1.8,
|
197
197
|
# the user is responsible for ensuring that strings contain UTF-8 data.
|
@@ -294,7 +294,7 @@ class Codecs
|
|
294
294
|
# (assuming target app knows how to handle new UInt64 type):
|
295
295
|
#
|
296
296
|
# def pack_uint64(val)
|
297
|
-
#
|
297
|
+
# AE::AEDesc.new(KAE::TypeUInt64, [val.to_f].pack('Q'))
|
298
298
|
# end
|
299
299
|
AE::AEDesc.new(KAE::TypeFloat, [val.to_f].pack('d')) # pack as 64-bit float for compatibility (lossy conversion)
|
300
300
|
end
|
@@ -169,8 +169,8 @@ module Connect
|
|
169
169
|
|
170
170
|
def Connect.local_app(path)
|
171
171
|
# Make an AEAddressDesc identifying a local application. (Application will be launched if not already running.)
|
172
|
-
#
|
173
|
-
#
|
172
|
+
# path : string -- full path to application, e.g. '/Applications/TextEdit.app'
|
173
|
+
# Result : AEAddressDesc
|
174
174
|
#
|
175
175
|
# Always creates AEAddressDesc by process serial number; that way there's no confusion if multiple versions of the same app are running.
|
176
176
|
path = @@encoding_support.to_utf8_string(path)
|
@@ -189,16 +189,16 @@ module Connect
|
|
189
189
|
|
190
190
|
def Connect.local_app_by_pid(pid)
|
191
191
|
# Make an AEAddressDesc identifying a running application by Unix process id.
|
192
|
-
#
|
193
|
-
#
|
192
|
+
# pid : integer -- unsigned 32-bit integer
|
193
|
+
# Result : AEAddressDesc
|
194
194
|
return AE::AEDesc.new(KAE::TypeKernelProcessID, [pid].pack('L'))
|
195
195
|
end
|
196
196
|
|
197
197
|
def Connect.remote_app(url)
|
198
198
|
url = @@encoding_support.to_utf8_string(url)
|
199
199
|
# Make an AEAddressDesc identifying a running application on another machine.
|
200
|
-
#
|
201
|
-
#
|
200
|
+
# url : string -- URL for remote application, e.g. 'eppc://user:password@0.0.0.1/TextEdit'
|
201
|
+
# Result : AEAddressDesc
|
202
202
|
raise ArgumentError, "Invalid url: #{url}" if not url.include?(':') # workaround: process will crash if no colon in URL (OS bug)
|
203
203
|
return AE::AEDesc.new(KAE::TypeApplicationURL, url)
|
204
204
|
end
|
@@ -42,8 +42,8 @@ module FindApp
|
|
42
42
|
# Absolute paths are also accepted. An '.app' suffix is optional.
|
43
43
|
#
|
44
44
|
# Examples:
|
45
|
-
#
|
46
|
-
#
|
45
|
+
# FindApp.by_name('TextEdit')
|
46
|
+
# FindApp.by_name('Finder.app')
|
47
47
|
#
|
48
48
|
if name[0, 1] != '/' # application name only, not its full path
|
49
49
|
begin
|
@@ -69,7 +69,7 @@ module FindApp
|
|
69
69
|
# Find the application with the given bundle id and return its full path.
|
70
70
|
#
|
71
71
|
# Examples:
|
72
|
-
#
|
72
|
+
# FindApp.by_id('com.apple.textedit')
|
73
73
|
#
|
74
74
|
return _find_app(nil, id, nil)
|
75
75
|
end
|
@@ -78,7 +78,7 @@ module FindApp
|
|
78
78
|
# Find the application with the given creator type and return its full path.
|
79
79
|
#
|
80
80
|
# Examples:
|
81
|
-
#
|
81
|
+
# FindApp.by_creator('ttxt')
|
82
82
|
#
|
83
83
|
return _find_app(creator, nil, nil)
|
84
84
|
end
|
@@ -61,11 +61,11 @@ module Send
|
|
61
61
|
#
|
62
62
|
# [1] Should be the sum of zero or more of the following kae module constants:
|
63
63
|
#
|
64
|
-
#
|
65
|
-
#
|
66
|
-
#
|
67
|
-
#
|
68
|
-
#
|
64
|
+
# KAENoReply | KAEQueueReply | KAEWaitReply
|
65
|
+
# KAEDontReconnect
|
66
|
+
# KAEWantReceipt
|
67
|
+
# KAENeverInteract | KAECanInteract | KAEAlwaysInteract
|
68
|
+
# KAECanSwitchLayer
|
69
69
|
|
70
70
|
begin
|
71
71
|
reply_event = _send_apple_event(flags, timeout)
|
@@ -75,11 +75,9 @@ module Send
|
|
75
75
|
end
|
76
76
|
else # Decode application's reply, if any. May be a return value, error number (and optional message), or nothing.
|
77
77
|
if reply_event.type != KAE::TypeNull
|
78
|
-
event_result = {
|
79
|
-
|
80
|
-
|
81
|
-
event_result[key] = value
|
82
|
-
end
|
78
|
+
event_result = reply_event.length.times.to_h { |i|
|
79
|
+
reply_event.get_item(i.next, KAE::TypeWildCard)
|
80
|
+
}
|
83
81
|
if event_result.has_key?(KAE::KeyErrorNumber) # The application raised an error.
|
84
82
|
# Error info is unpacked using default codecs for reliability.
|
85
83
|
e_num = DefaultCodecs.unpack(event_result[KAE::KeyErrorNumber])
|
@@ -103,8 +101,8 @@ module Send
|
|
103
101
|
# Represents an error raised by the Apple Event Manager or target application when a command fails.
|
104
102
|
#
|
105
103
|
# Methods:
|
106
|
-
#
|
107
|
-
#
|
104
|
+
# number : integer -- MacOS error number
|
105
|
+
# message : string -- application error message if any, or default error description if available
|
108
106
|
|
109
107
|
# Most applications don't provide error description strings, so define default descriptions for the common ones.
|
110
108
|
# Following default error descriptions are cribbed from the AppleScript Language Guide/MacErrors.h:
|
@@ -221,12 +221,12 @@ class ReferenceRenderer
|
|
221
221
|
def ReferenceRenderer.render(app_data, aem_reference)
|
222
222
|
# Take an aem reference, e.g.:
|
223
223
|
#
|
224
|
-
#
|
224
|
+
# app.elements('docu').by_index(1).property('ctxt')
|
225
225
|
#
|
226
226
|
# and an AppData instance containing application's location and terminology,
|
227
227
|
# and render an appscript-style reference string, e.g.:
|
228
228
|
#
|
229
|
-
#
|
229
|
+
# "AS.app('/Applications/TextEdit.app').documents[1].text"
|
230
230
|
#
|
231
231
|
# Used by AS::Reference#to_s
|
232
232
|
#
|
@@ -447,15 +447,15 @@ module Terminology
|
|
447
447
|
#
|
448
448
|
# Call the #dump method to dump faulty aetes to Ruby module, e.g.:
|
449
449
|
#
|
450
|
-
#
|
450
|
+
# Terminology.dump('MyApp', 'MyAppGlue', '/path/to/ruby/modules/myappglue.rb')
|
451
451
|
#
|
452
452
|
# Patch any errors by hand, then import the patched module into your script
|
453
453
|
# and pass it to appscript's app() constructor via its 'terms' argument, e.g.:
|
454
454
|
#
|
455
|
-
#
|
456
|
-
#
|
455
|
+
# require 'appscript'; include Appscript
|
456
|
+
# require 'myappglue'
|
457
457
|
#
|
458
|
-
#
|
458
|
+
# myapp = app('MyApp', terms => MyAppGlue)
|
459
459
|
#
|
460
460
|
# Note that dumped terminologies aren't used by appscript's built-in help system.
|
461
461
|
#
|
data/{src/lib → lib}/aem.rb
RENAMED
@@ -210,11 +210,11 @@ module AEM
|
|
210
210
|
|
211
211
|
def event(event, params={}, atts={}, return_id=KAE::KAutoGenerateReturnID, codecs=DefaultCodecs)
|
212
212
|
# Construct an Apple event targetted at this application.
|
213
|
-
#
|
214
|
-
#
|
215
|
-
#
|
216
|
-
#
|
217
|
-
#
|
213
|
+
# event : string -- 8-letter code indicating event's class, e.g. 'coregetd'
|
214
|
+
# params : hash -- a dict of form {AE_code:anything,...} containing zero or more event parameters (message arguments)
|
215
|
+
# atts : hash -- a dict of form {AE_code:anything,...} containing zero or more event attributes (event info)
|
216
|
+
# return_id : integer -- reply event's ID
|
217
|
+
# codecs : Codecs -- codecs object to use when packing/unpacking this event
|
218
218
|
return self.class::Event.new(@address_desc, event, params, atts, @_transaction, return_id, codecs)
|
219
219
|
end
|
220
220
|
|
data/{src/lib → lib}/rb-scpt.rb
RENAMED
@@ -9,8 +9,6 @@ require "_aem/mactypes"
|
|
9
9
|
|
10
10
|
module Appscript
|
11
11
|
|
12
|
-
Version = '1.0.1'
|
13
|
-
|
14
12
|
# The following methods and classes are of interest to end users:
|
15
13
|
# app, con, its, CommandError, ApplicationNotFoundError, CantLaunchApplicationError
|
16
14
|
# Other classes are only of interest to implementors who need to hook in their own code.
|
data/lib/version.rb
ADDED
data/rb-scpt.gemspec
CHANGED
@@ -1,14 +1,19 @@
|
|
1
1
|
require "rubygems"
|
2
2
|
|
3
|
+
require "./lib/version.rb"
|
4
|
+
|
3
5
|
Gem::Specification.new do |s|
|
4
|
-
s.name
|
5
|
-
s.version
|
6
|
-
s.homepage
|
7
|
-
s.summary="This is a fork of the original rb-appscript. Ruby AppleScript (rb-scpt) is a high-level, user-friendly Apple event bridge that allows you to control scriptable Mac OS X applications using ordinary Ruby scripts."
|
8
|
-
s.files
|
9
|
-
s.extensions =
|
10
|
-
s.test_files =
|
11
|
-
s.authors
|
12
|
-
s.email
|
13
|
-
|
6
|
+
s.name = "rb-scpt"
|
7
|
+
s.version = Appscript::Version
|
8
|
+
s.homepage = "https://github.com/BrendanThompson/rb-scpt"
|
9
|
+
s.summary = "This is a fork of the original rb-appscript. Ruby AppleScript (rb-scpt) is a high-level, user-friendly Apple event bridge that allows you to control scriptable Mac OS X applications using ordinary Ruby scripts."
|
10
|
+
s.files = File.readlines("Manifest.txt", chomp:true)
|
11
|
+
s.extensions = s.files.grep(/extconf.rb/)
|
12
|
+
s.test_files = s.files.grep(/^test/)
|
13
|
+
s.authors = ["hhas","Brendan Thompson"]
|
14
|
+
s.email = 'brendan@btsystems.com.au'
|
15
|
+
|
16
|
+
s.license = "AML"
|
17
|
+
|
18
|
+
s.required_ruby_version = ">= 2.7"
|
14
19
|
end
|
data/test/test_aemreference.rb
CHANGED
@@ -93,11 +93,11 @@ class TC_AEMReferences < Minitest::Test
|
|
93
93
|
val2 = DefaultCodecs.unpack(d)
|
94
94
|
assert_equal(val, val2)
|
95
95
|
val2 = DefaultCodecs.unpack(d)
|
96
|
-
|
96
|
+
assert_operator val, :eql?, val2
|
97
97
|
val2 = DefaultCodecs.unpack(d)
|
98
98
|
assert_equal(val2, val)
|
99
99
|
val2 = DefaultCodecs.unpack(d)
|
100
|
-
|
100
|
+
assert_operator val2, :eql?, val
|
101
101
|
rescue
|
102
102
|
puts 'EXPECTED: ' + res
|
103
103
|
raise
|
@@ -108,7 +108,7 @@ class TC_AEMReferences < Minitest::Test
|
|
108
108
|
refute_equal(AEMReference::App.elements('ctxt').property('ctxt'), AEMReference::App.property('ctxt').property('ctxt'))
|
109
109
|
refute_equal(AEMReference::App.elements('ctxt').property('ctxt'), 333)
|
110
110
|
refute_equal(333, AEMReference::App.property('ctxt').property('ctxt'))
|
111
|
-
#
|
111
|
+
# by-filter references do basic type checking to ensure an its-based reference is given
|
112
112
|
assert_raises(TypeError) { AEMReference::App.elements('docu').by_filter(1) }
|
113
113
|
|
114
114
|
end
|