rb-scpt 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES +497 -0
- data/doc/aem-manual/01_introduction.html +60 -0
- data/doc/aem-manual/02_apioverview.html +107 -0
- data/doc/aem-manual/03_packingandunpackingdata.html +135 -0
- data/doc/aem-manual/04_references.html +409 -0
- data/doc/aem-manual/05_targetingapplications.html +164 -0
- data/doc/aem-manual/06_buildingandsendingevents.html +229 -0
- data/doc/aem-manual/07_findapp.html +63 -0
- data/doc/aem-manual/08_examples.html +94 -0
- data/doc/aem-manual/aemreferenceinheritance.gif +0 -0
- data/doc/aem-manual/index.html +56 -0
- data/doc/appscript-manual/01_introduction.html +94 -0
- data/doc/appscript-manual/02_aboutappscripting.html +247 -0
- data/doc/appscript-manual/03_quicktutorial.html +167 -0
- data/doc/appscript-manual/04_gettinghelp.html +188 -0
- data/doc/appscript-manual/05_keywordconversion.html +106 -0
- data/doc/appscript-manual/06_classesandenums.html +192 -0
- data/doc/appscript-manual/07_applicationobjects.html +211 -0
- data/doc/appscript-manual/08_realvsgenericreferences.html +96 -0
- data/doc/appscript-manual/09_referenceforms.html +241 -0
- data/doc/appscript-manual/10_referenceexamples.html +154 -0
- data/doc/appscript-manual/11_applicationcommands.html +245 -0
- data/doc/appscript-manual/12_commandexamples.html +138 -0
- data/doc/appscript-manual/13_performanceissues.html +142 -0
- data/doc/appscript-manual/14_notes.html +80 -0
- data/doc/appscript-manual/application_architecture.gif +0 -0
- data/doc/appscript-manual/application_architecture2.gif +0 -0
- data/doc/appscript-manual/finder_to_textedit_event.gif +0 -0
- data/doc/appscript-manual/index.html +62 -0
- data/doc/appscript-manual/relationships_example.gif +0 -0
- data/doc/appscript-manual/ruby_to_itunes_event.gif +0 -0
- data/doc/full.css +106 -0
- data/doc/index.html +45 -0
- data/doc/mactypes-manual/01_introduction.html +54 -0
- data/doc/mactypes-manual/02_aliasclass.html +124 -0
- data/doc/mactypes-manual/03_fileurlclass.html +126 -0
- data/doc/mactypes-manual/04_unitsclass.html +100 -0
- data/doc/mactypes-manual/index.html +53 -0
- data/doc/osax-manual/01_introduction.html +67 -0
- data/doc/osax-manual/02_interface.html +147 -0
- data/doc/osax-manual/03_examples.html +73 -0
- data/doc/osax-manual/04_notes.html +61 -0
- data/doc/osax-manual/index.html +53 -0
- data/doc/rb-appscript-logo.png +0 -0
- data/extconf.rb +65 -0
- data/rb-scpt.gemspec +14 -0
- data/sample/AB_export_vcard.rb +31 -0
- data/sample/AB_list_people_with_emails.rb +13 -0
- data/sample/Add_iCal_event.rb +21 -0
- data/sample/Create_daily_iCal_todos.rb +75 -0
- data/sample/Export_Address_Book_phone_numbers.rb +59 -0
- data/sample/Hello_world.rb +21 -0
- data/sample/List_iTunes_playlist_names.rb +11 -0
- data/sample/Make_Mail_message.rb +33 -0
- data/sample/Open_file_in_TextEdit.rb +13 -0
- data/sample/Organize_Mail_messages.rb +61 -0
- data/sample/Print_folder_tree.rb +16 -0
- data/sample/Select_all_HTML_files.rb +14 -0
- data/sample/Set_iChat_status.rb +24 -0
- data/sample/Simple_Finder_GUI_Scripting.rb +18 -0
- data/sample/Stagger_Finder_windows.rb +25 -0
- data/sample/TextEdit_demo.rb +130 -0
- data/sample/iTunes_top40_to_html.rb +71 -0
- data/src/SendThreadSafe.c +380 -0
- data/src/SendThreadSafe.h +139 -0
- data/src/lib/_aem/aemreference.rb +1022 -0
- data/src/lib/_aem/codecs.rb +662 -0
- data/src/lib/_aem/connect.rb +205 -0
- data/src/lib/_aem/encodingsupport.rb +77 -0
- data/src/lib/_aem/findapp.rb +85 -0
- data/src/lib/_aem/mactypes.rb +251 -0
- data/src/lib/_aem/send.rb +279 -0
- data/src/lib/_aem/typewrappers.rb +59 -0
- data/src/lib/_appscript/defaultterminology.rb +277 -0
- data/src/lib/_appscript/referencerenderer.rb +245 -0
- data/src/lib/_appscript/reservedkeywords.rb +116 -0
- data/src/lib/_appscript/safeobject.rb +249 -0
- data/src/lib/_appscript/terminology.rb +471 -0
- data/src/lib/aem.rb +253 -0
- data/src/lib/appscript.rb +1075 -0
- data/src/lib/kae.rb +1489 -0
- data/src/lib/osax.rb +659 -0
- data/src/rbae.c +979 -0
- data/test/README +3 -0
- data/test/test_aemreference.rb +118 -0
- data/test/test_appscriptcommands.rb +152 -0
- data/test/test_appscriptreference.rb +106 -0
- data/test/test_codecs.rb +186 -0
- data/test/test_findapp.rb +26 -0
- data/test/test_mactypes.rb +79 -0
- data/test/test_osax.rb +54 -0
- data/test/testall.sh +10 -0
- metadata +145 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
|
3
|
+
begin; require 'rubygems'; rescue LoadError; end
|
4
|
+
|
5
|
+
require 'test/unit'
|
6
|
+
require "_aem/findapp"
|
7
|
+
|
8
|
+
|
9
|
+
class TC_FindApp < Test::Unit::TestCase
|
10
|
+
|
11
|
+
def test_find
|
12
|
+
[
|
13
|
+
['/Applications/iCal.app', '/Applications/iCal.app'],
|
14
|
+
['ical.app', '/Applications/iCal.app'],
|
15
|
+
['ICAL', '/Applications/iCal.app'],
|
16
|
+
].each do |val, res|
|
17
|
+
assert_equal(res, FindApp.by_name(val))
|
18
|
+
end
|
19
|
+
assert_equal('/Applications/TextEdit.app', FindApp.by_creator('ttxt'))
|
20
|
+
assert_equal('/System/Library/CoreServices/Finder.app', FindApp.by_id('com.apple.finder'))
|
21
|
+
assert_raises(FindApp::ApplicationNotFoundError) { FindApp.by_name('NON-EXISTENT-APP') }
|
22
|
+
|
23
|
+
# assert_equal("/Users/has/\306\222\303\270u\314\210.app", FindApp.by_name("\306\222\303\270u\314\210.app")) # utf8 paths work ok
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,79 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
|
3
|
+
begin; require 'rubygems'; rescue LoadError; end
|
4
|
+
|
5
|
+
require 'test/unit'
|
6
|
+
require "_aem/mactypes"
|
7
|
+
|
8
|
+
|
9
|
+
class TC_MacTypes < Test::Unit::TestCase
|
10
|
+
|
11
|
+
def setup
|
12
|
+
@path1 = `mktemp -t codecs-test`.chomp
|
13
|
+
dir, fname = File.split(@path1)
|
14
|
+
@path2 = File.join(dir, 'moved-' + fname)
|
15
|
+
# puts "path: #{@path1}" # e.g. /tmp/codecs-test.HWr1EnE3
|
16
|
+
end
|
17
|
+
|
18
|
+
def normalize(path)
|
19
|
+
return path.gsub(/\/+/, '/') # quick-n-dirty
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_alias
|
23
|
+
# make alias
|
24
|
+
f = MacTypes::Alias.path(@path1)
|
25
|
+
|
26
|
+
|
27
|
+
assert_equal(MacTypes::Alias.path(@path1), f)
|
28
|
+
|
29
|
+
# get path
|
30
|
+
# note that initial /tmp/codecs-test... path will automatically change to /private/tmp/codecs-test...
|
31
|
+
p1 = normalize('/private'+@path1)
|
32
|
+
p2 = normalize('/private'+@path2)
|
33
|
+
|
34
|
+
assert_equal(p1, normalize(f.path))
|
35
|
+
|
36
|
+
#puts "alias path 1: #{f}" # e.g. /private/tmp/codecs-test.HWr1EnE3
|
37
|
+
assert_equal(p1, f.to_s)
|
38
|
+
|
39
|
+
# get desc
|
40
|
+
#puts f.desc.type, f.desc.data # alis, [binary data]
|
41
|
+
assert_equal('alis', f.desc.type)
|
42
|
+
|
43
|
+
|
44
|
+
# check alias keeps track of moved file
|
45
|
+
`mv #{@path1} #{@path2}`
|
46
|
+
# puts "alias path 2: #{f}" # /private/tmp/moved-codecs-test.HWr1EnE3
|
47
|
+
assert_equal(p2, f.to_s)
|
48
|
+
|
49
|
+
assert_equal(p2, normalize(f.path))
|
50
|
+
|
51
|
+
# check a FileNotFoundError is raised if getting path/FileURL for a filesystem object that no longer exists
|
52
|
+
`rm #{@path2}`
|
53
|
+
assert_raises(MacTypes::FileNotFoundError) { f.to_s } # File not found.
|
54
|
+
assert_raises(MacTypes::FileNotFoundError) { f.to_file_url } # File not found.
|
55
|
+
|
56
|
+
assert_equal(MacTypes::Alias.path("/Library/Scripts/"), MacTypes::Alias.path("/Library/Scripts/"))
|
57
|
+
assert_not_equal(MacTypes::Alias.path("/Library/Scripts/"), MacTypes::Alias.path("/Applications/"))
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
def test_file_url
|
62
|
+
|
63
|
+
g = MacTypes::FileURL.path('/non/existent path')
|
64
|
+
|
65
|
+
assert_equal('/non/existent path', g.to_s)
|
66
|
+
|
67
|
+
assert_equal('furl', g.desc.type)
|
68
|
+
assert_equal('file://localhost/non/existent%20path', g.desc.data)
|
69
|
+
|
70
|
+
assert_equal('MacTypes::FileURL.path("/non/existent path")', g.to_file_url.inspect)
|
71
|
+
|
72
|
+
# check a not-found error is raised if getting Alias for a filesystem object that doesn't exist
|
73
|
+
assert_raises(MacTypes::FileNotFoundError) { g.to_alias } # File "/non/existent path" not found.
|
74
|
+
|
75
|
+
assert_equal(MacTypes::FileURL.path("/Library/Scripts/"), MacTypes::FileURL.path("/Library/Scripts/"))
|
76
|
+
assert_not_equal(MacTypes::FileURL.path("/Library/Scripts/"), MacTypes::FileURL.path("/Applications/"))
|
77
|
+
assert_not_equal(MacTypes::FileURL.path("/Library/Scripts/"), MacTypes::Alias.path("/Library/Scripts/"))
|
78
|
+
end
|
79
|
+
end
|
data/test/test_osax.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
|
3
|
+
begin; require 'rubygems'; rescue LoadError; end
|
4
|
+
|
5
|
+
require 'test/unit'
|
6
|
+
require 'osax'
|
7
|
+
|
8
|
+
class TC_OSAX < Test::Unit::TestCase
|
9
|
+
|
10
|
+
def test_1
|
11
|
+
sa = OSAX.osax('Standardadditions')
|
12
|
+
|
13
|
+
assert_equal(65, sa.ASCII_number('A'))
|
14
|
+
|
15
|
+
assert_equal(MacTypes::Alias.path("/Applications/"), sa.path_to(:applications_folder))
|
16
|
+
|
17
|
+
assert_equal(MacTypes::Alias.path("/Library/Scripts/"),
|
18
|
+
sa.path_to(:scripts_folder, :from=>:local_domain))
|
19
|
+
|
20
|
+
assert_raises(RuntimeError) { sa.non_existent_command }
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_2
|
24
|
+
sa = OSAX.osax('Standardadditions').by_name('Finder')
|
25
|
+
assert_equal(65, sa.ASCII_number('A'))
|
26
|
+
assert_equal(MacTypes::Alias.path("/System/Library/CoreServices/Finder.app/"), sa.path_to(nil))
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_3
|
30
|
+
sa = OSAX.osax('Standardadditions').by_creator('MACS')
|
31
|
+
assert_equal(65, sa.ASCII_number('A'))
|
32
|
+
assert_equal(MacTypes::Alias.path("/System/Library/CoreServices/Finder.app/"), sa.path_to(nil))
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_4
|
36
|
+
sa = OSAX.osax('Standardadditions').by_id('com.apple.finder')
|
37
|
+
assert_equal(65, sa.ASCII_number('A'))
|
38
|
+
assert_equal(MacTypes::Alias.path("/System/Library/CoreServices/Finder.app/"), sa.path_to(nil))
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_5
|
42
|
+
sa = OSAX.osax('Standardadditions').by_pid(`top -l1 | grep Finder | awk '{ print $1 }'`.to_i)
|
43
|
+
assert_equal(MacTypes::Alias.path("/System/Library/CoreServices/Finder.app/"), sa.path_to(nil))
|
44
|
+
assert_equal(65, sa.ASCII_number('A'))
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_6
|
48
|
+
sa = OSAX.osax('Standardadditions').by_aem_app(AEM::Application.by_path("/System/Library/CoreServices/Finder.app/"))
|
49
|
+
assert_equal(65, sa.ASCII_number('A'))
|
50
|
+
assert_equal(MacTypes::Alias.path("/System/Library/CoreServices/Finder.app/"), sa.path_to(nil))
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
end
|
data/test/testall.sh
ADDED
metadata
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rb-scpt
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- hhas
|
8
|
+
- Brendan Thompson
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-07-14 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description:
|
15
|
+
email: brendan@btsystems.com.au
|
16
|
+
executables: []
|
17
|
+
extensions:
|
18
|
+
- extconf.rb
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- CHANGES
|
22
|
+
- doc/aem-manual/01_introduction.html
|
23
|
+
- doc/aem-manual/02_apioverview.html
|
24
|
+
- doc/aem-manual/03_packingandunpackingdata.html
|
25
|
+
- doc/aem-manual/04_references.html
|
26
|
+
- doc/aem-manual/05_targetingapplications.html
|
27
|
+
- doc/aem-manual/06_buildingandsendingevents.html
|
28
|
+
- doc/aem-manual/07_findapp.html
|
29
|
+
- doc/aem-manual/08_examples.html
|
30
|
+
- doc/aem-manual/aemreferenceinheritance.gif
|
31
|
+
- doc/aem-manual/index.html
|
32
|
+
- doc/appscript-manual/01_introduction.html
|
33
|
+
- doc/appscript-manual/02_aboutappscripting.html
|
34
|
+
- doc/appscript-manual/03_quicktutorial.html
|
35
|
+
- doc/appscript-manual/04_gettinghelp.html
|
36
|
+
- doc/appscript-manual/05_keywordconversion.html
|
37
|
+
- doc/appscript-manual/06_classesandenums.html
|
38
|
+
- doc/appscript-manual/07_applicationobjects.html
|
39
|
+
- doc/appscript-manual/08_realvsgenericreferences.html
|
40
|
+
- doc/appscript-manual/09_referenceforms.html
|
41
|
+
- doc/appscript-manual/10_referenceexamples.html
|
42
|
+
- doc/appscript-manual/11_applicationcommands.html
|
43
|
+
- doc/appscript-manual/12_commandexamples.html
|
44
|
+
- doc/appscript-manual/13_performanceissues.html
|
45
|
+
- doc/appscript-manual/14_notes.html
|
46
|
+
- doc/appscript-manual/application_architecture.gif
|
47
|
+
- doc/appscript-manual/application_architecture2.gif
|
48
|
+
- doc/appscript-manual/finder_to_textedit_event.gif
|
49
|
+
- doc/appscript-manual/index.html
|
50
|
+
- doc/appscript-manual/relationships_example.gif
|
51
|
+
- doc/appscript-manual/ruby_to_itunes_event.gif
|
52
|
+
- doc/full.css
|
53
|
+
- doc/index.html
|
54
|
+
- doc/mactypes-manual/01_introduction.html
|
55
|
+
- doc/mactypes-manual/02_aliasclass.html
|
56
|
+
- doc/mactypes-manual/03_fileurlclass.html
|
57
|
+
- doc/mactypes-manual/04_unitsclass.html
|
58
|
+
- doc/mactypes-manual/index.html
|
59
|
+
- doc/osax-manual/01_introduction.html
|
60
|
+
- doc/osax-manual/02_interface.html
|
61
|
+
- doc/osax-manual/03_examples.html
|
62
|
+
- doc/osax-manual/04_notes.html
|
63
|
+
- doc/osax-manual/index.html
|
64
|
+
- doc/rb-appscript-logo.png
|
65
|
+
- extconf.rb
|
66
|
+
- rb-scpt.gemspec
|
67
|
+
- sample/AB_export_vcard.rb
|
68
|
+
- sample/AB_list_people_with_emails.rb
|
69
|
+
- sample/Add_iCal_event.rb
|
70
|
+
- sample/Create_daily_iCal_todos.rb
|
71
|
+
- sample/Export_Address_Book_phone_numbers.rb
|
72
|
+
- sample/Hello_world.rb
|
73
|
+
- sample/List_iTunes_playlist_names.rb
|
74
|
+
- sample/Make_Mail_message.rb
|
75
|
+
- sample/Open_file_in_TextEdit.rb
|
76
|
+
- sample/Organize_Mail_messages.rb
|
77
|
+
- sample/Print_folder_tree.rb
|
78
|
+
- sample/Select_all_HTML_files.rb
|
79
|
+
- sample/Set_iChat_status.rb
|
80
|
+
- sample/Simple_Finder_GUI_Scripting.rb
|
81
|
+
- sample/Stagger_Finder_windows.rb
|
82
|
+
- sample/TextEdit_demo.rb
|
83
|
+
- sample/iTunes_top40_to_html.rb
|
84
|
+
- src/SendThreadSafe.c
|
85
|
+
- src/SendThreadSafe.h
|
86
|
+
- src/lib/_aem/aemreference.rb
|
87
|
+
- src/lib/_aem/codecs.rb
|
88
|
+
- src/lib/_aem/connect.rb
|
89
|
+
- src/lib/_aem/encodingsupport.rb
|
90
|
+
- src/lib/_aem/findapp.rb
|
91
|
+
- src/lib/_aem/mactypes.rb
|
92
|
+
- src/lib/_aem/send.rb
|
93
|
+
- src/lib/_aem/typewrappers.rb
|
94
|
+
- src/lib/_appscript/defaultterminology.rb
|
95
|
+
- src/lib/_appscript/referencerenderer.rb
|
96
|
+
- src/lib/_appscript/reservedkeywords.rb
|
97
|
+
- src/lib/_appscript/safeobject.rb
|
98
|
+
- src/lib/_appscript/terminology.rb
|
99
|
+
- src/lib/aem.rb
|
100
|
+
- src/lib/appscript.rb
|
101
|
+
- src/lib/kae.rb
|
102
|
+
- src/lib/osax.rb
|
103
|
+
- src/rbae.c
|
104
|
+
- test/README
|
105
|
+
- test/test_aemreference.rb
|
106
|
+
- test/test_appscriptcommands.rb
|
107
|
+
- test/test_appscriptreference.rb
|
108
|
+
- test/test_codecs.rb
|
109
|
+
- test/test_findapp.rb
|
110
|
+
- test/test_mactypes.rb
|
111
|
+
- test/test_osax.rb
|
112
|
+
- test/testall.sh
|
113
|
+
homepage: https://github.com/BrendanThompson/rb-scpt
|
114
|
+
licenses: []
|
115
|
+
metadata: {}
|
116
|
+
post_install_message:
|
117
|
+
rdoc_options: []
|
118
|
+
require_paths:
|
119
|
+
- lib
|
120
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.8'
|
125
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
requirements: []
|
131
|
+
rubyforge_project:
|
132
|
+
rubygems_version: 2.4.5
|
133
|
+
signing_key:
|
134
|
+
specification_version: 4
|
135
|
+
summary: This is a fork of the original rb-appscript. Ruby AppleScript (rb-scpt) is
|
136
|
+
a high-level, user-friendly Apple event bridge that allows you to control scriptable
|
137
|
+
Mac OS X applications using ordinary Ruby scripts.
|
138
|
+
test_files:
|
139
|
+
- test/test_aemreference.rb
|
140
|
+
- test/test_appscriptcommands.rb
|
141
|
+
- test/test_appscriptreference.rb
|
142
|
+
- test/test_codecs.rb
|
143
|
+
- test/test_findapp.rb
|
144
|
+
- test/test_mactypes.rb
|
145
|
+
- test/test_osax.rb
|