rb-scpt 1.0.0
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 +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,53 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
|
|
5
|
+
<title>rb-mactypes manual</title>
|
|
6
|
+
|
|
7
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
8
|
+
<style type="text/css" media="all"><!--@import url(../full.css);--></style>
|
|
9
|
+
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
|
|
13
|
+
<h1><img src="../rb-appscript-logo.png" alt="rb-appscript" title="rb-appscript" /></h1>
|
|
14
|
+
|
|
15
|
+
<!-- top navigation -->
|
|
16
|
+
<div class="navbar">
|
|
17
|
+
<a href="../index.html">Previous</a> •
|
|
18
|
+
<a href="../index.html">Up</a> •
|
|
19
|
+
<a href="01_introduction.html">Next</a>
|
|
20
|
+
|
|
21
|
+
<span>
|
|
22
|
+
<a href="../appscript-manual/index.html">appscript</a> /
|
|
23
|
+
<strong><a href="../mactypes-manual/index.html">mactypes</a></strong> /
|
|
24
|
+
<a href="../osax-manual/index.html">osax</a> /
|
|
25
|
+
<a href="../aem-manual/index.html">aem</a>
|
|
26
|
+
</span>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<!-- content -->
|
|
30
|
+
<div id="content">
|
|
31
|
+
|
|
32
|
+
<h2>Contents</h2>
|
|
33
|
+
|
|
34
|
+
<ol>
|
|
35
|
+
<li><a href="01_introduction.html">Introduction</a></li>
|
|
36
|
+
<li><a href="02_aliasclass.html">Alias class</a></li>
|
|
37
|
+
<li><a href="03_fileurlclass.html">FileURL class</a></li>
|
|
38
|
+
<li><a href="04_unitsclass.html">Units class</a></li>
|
|
39
|
+
|
|
40
|
+
</ol>
|
|
41
|
+
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<!-- bottom navigation -->
|
|
45
|
+
|
|
46
|
+
<div class="footer">
|
|
47
|
+
<a href="../index.html">Previous</a> •
|
|
48
|
+
<a href="../index.html">Up</a> •
|
|
49
|
+
<a href="01_introduction.html">Next</a>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
</body>
|
|
53
|
+
</html>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
|
|
5
|
+
<title>rb-osax manual | 1. Introduction</title>
|
|
6
|
+
|
|
7
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
8
|
+
<style type="text/css" media="all"><!--@import url(../full.css);--></style>
|
|
9
|
+
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
|
|
13
|
+
<h1><img src="../rb-appscript-logo.png" alt="rb-appscript" title="rb-appscript" /></h1>
|
|
14
|
+
|
|
15
|
+
<!-- top navigation -->
|
|
16
|
+
<div class="navbar">
|
|
17
|
+
<a href="index.html">Previous</a> •
|
|
18
|
+
<a href="index.html">Up</a> •
|
|
19
|
+
<a href="02_interface.html">Next</a>
|
|
20
|
+
|
|
21
|
+
<span>
|
|
22
|
+
<a href="../appscript-manual/index.html">appscript</a> /
|
|
23
|
+
<a href="../mactypes-manual/index.html">mactypes</a> /
|
|
24
|
+
<strong><a href="../osax-manual/index.html">osax</a></strong> /
|
|
25
|
+
<a href="../aem-manual/index.html">aem</a>
|
|
26
|
+
</span>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<!-- content -->
|
|
30
|
+
<div id="content">
|
|
31
|
+
|
|
32
|
+
<h2>1. Introduction</h2>
|
|
33
|
+
|
|
34
|
+
<h3>About osax</h3>
|
|
35
|
+
|
|
36
|
+
<p>The <code>OSAX</code> module provides an easy way to call scripting additions (a.k.a. OSAXen) from Ruby. It exports a single public class, <code>ScriptingAddition</code>, and two functions, <code>osax</code> and <code>scripting_additions</code>.</p>
|
|
37
|
+
|
|
38
|
+
<p>The <code>ScriptingAddition</code> class represents a single scripting addition. It is similar to an appscript application object, except that it defines commands for the specified scripting addition instead of the application's normal commands. </p>
|
|
39
|
+
|
|
40
|
+
<p>Once you've created a <code>ScriptingAddition</code> instance, you can invoke its commands in exactly the same way as you would call a scriptable application's commands in appscript.</p>
|
|
41
|
+
|
|
42
|
+
<p>For example:</p>
|
|
43
|
+
|
|
44
|
+
<pre><code>require "osax"
|
|
45
|
+
|
|
46
|
+
sa = OSAX::ScriptingAddition.new("StandardAdditions")
|
|
47
|
+
|
|
48
|
+
sa.say("Hello world", :using=>"Victoria")</code></pre>
|
|
49
|
+
|
|
50
|
+
<p>The default application commands (<code>run</code>, <code>activate</code>, <code>quit</code>, etc.) are also available; see the appscript manual for details on those.</p>
|
|
51
|
+
|
|
52
|
+
<p>By default, <code>ScriptingAddition</code> objects are targeted at the current application. You can obtain a <code>ScriptingAddition</code> object targeted at another application by calling one of its <code>by...</code> methods.</p>
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<!-- bottom navigation -->
|
|
59
|
+
|
|
60
|
+
<div class="footer">
|
|
61
|
+
<a href="index.html">Previous</a> •
|
|
62
|
+
<a href="index.html">Up</a> •
|
|
63
|
+
<a href="02_interface.html">Next</a>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
</body>
|
|
67
|
+
</html>
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
|
|
5
|
+
<title>rb-osax manual | 2. Interface</title>
|
|
6
|
+
|
|
7
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
8
|
+
<style type="text/css" media="all"><!--@import url(../full.css);--></style>
|
|
9
|
+
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
|
|
13
|
+
<h1><img src="../rb-appscript-logo.png" alt="rb-appscript" title="rb-appscript" /></h1>
|
|
14
|
+
|
|
15
|
+
<!-- top navigation -->
|
|
16
|
+
<div class="navbar">
|
|
17
|
+
<a href="01_introduction.html">Previous</a> •
|
|
18
|
+
<a href="index.html">Up</a> •
|
|
19
|
+
<a href="03_examples.html">Next</a>
|
|
20
|
+
|
|
21
|
+
<span>
|
|
22
|
+
<a href="../appscript-manual/index.html">appscript</a> /
|
|
23
|
+
<a href="../mactypes-manual/index.html">mactypes</a> /
|
|
24
|
+
<strong><a href="../osax-manual/index.html">osax</a></strong> /
|
|
25
|
+
<a href="../aem-manual/index.html">aem</a>
|
|
26
|
+
</span>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<!-- content -->
|
|
30
|
+
<div id="content">
|
|
31
|
+
|
|
32
|
+
<h2>2. Interface</h2>
|
|
33
|
+
|
|
34
|
+
<h3>The <code>scriptingadditions</code> method</h3>
|
|
35
|
+
|
|
36
|
+
<p>The <code>OSAX.scripting_additions</code> method returns the names of all installed scripting additions:</p>
|
|
37
|
+
|
|
38
|
+
<pre><code>require "osax"
|
|
39
|
+
|
|
40
|
+
p OSAX.scripting_additions
|
|
41
|
+
# Result: ["Digital Hub Scripting", "StandardAdditions", ...]</code></pre>
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
<h3>The <code>osax</code> method</h3>
|
|
45
|
+
|
|
46
|
+
<p>The <code>OSAX.osax</code> method provides a convenient shortcut for creating new <code>ScriptingAddition</code> instances.</p>
|
|
47
|
+
|
|
48
|
+
<pre><code>osax(name=nil, app_name=nil) -- convenience method for
|
|
49
|
+
creating a new ScriptingAddition instance
|
|
50
|
+
name : String | nil -- scripting addition's name
|
|
51
|
+
(nil = "StandardAdditions")
|
|
52
|
+
app_name : String | nil -- target application's name/path, or nil
|
|
53
|
+
for current application
|
|
54
|
+
Result : ScriptingAddition</code></pre>
|
|
55
|
+
|
|
56
|
+
<p>For example:</p>
|
|
57
|
+
|
|
58
|
+
<pre><code>require "osax"
|
|
59
|
+
|
|
60
|
+
sa = OSAX.osax
|
|
61
|
+
|
|
62
|
+
p sa
|
|
63
|
+
# Result: #<OSAX::ScriptingAddition
|
|
64
|
+
# name="StandardAdditions"
|
|
65
|
+
# target=AEM::Application.current></code></pre>
|
|
66
|
+
|
|
67
|
+
<p>In addition, the <code>osax</code> function accepts an application name as an optional second argument, allowing you to specify the application you want to handle the scripting addition's commands, e.g.:</p>
|
|
68
|
+
|
|
69
|
+
<pre><code>OSAX.osax("StandardAdditions", "System Events")</code></pre>
|
|
70
|
+
|
|
71
|
+
<p>is shorthand for:</p>
|
|
72
|
+
|
|
73
|
+
<pre><code>OSAX::ScriptingAddition.new("StandardAdditions").by_name("System Events")</code></pre>
|
|
74
|
+
|
|
75
|
+
<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>
|
|
76
|
+
|
|
77
|
+
<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>
|
|
78
|
+
|
|
79
|
+
<pre><code>sa = osax
|
|
80
|
+
sa.some_command
|
|
81
|
+
sa.another_command</code></pre>
|
|
82
|
+
|
|
83
|
+
<p>could also be written as:</p>
|
|
84
|
+
|
|
85
|
+
<pre><code>osax.some_command
|
|
86
|
+
osax.another_command</code></pre>
|
|
87
|
+
|
|
88
|
+
<p>without the additional overhead of creating a new ScriptingAddition object each time.</p>
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
<h3>The <code>ScriptingAddition</code> class</h3>
|
|
92
|
+
|
|
93
|
+
<pre><code>ScriptingAddition -- represents a single scripting addition and its
|
|
94
|
+
target application
|
|
95
|
+
|
|
96
|
+
Constructors:
|
|
97
|
+
|
|
98
|
+
ScriptingAddition.new(name, terms=nil) -- make a ScriptingAddition
|
|
99
|
+
object for the specified scripting addition, targeted
|
|
100
|
+
at the current application
|
|
101
|
+
|
|
102
|
+
name: string -- a scripting addition's name,
|
|
103
|
+
e.g. "StandardAdditions"; basically its filename
|
|
104
|
+
minus the '.osax' suffix
|
|
105
|
+
|
|
106
|
+
terms : module or nil -- an optional terminology glue
|
|
107
|
+
module,as exported by Terminology.dump; if
|
|
108
|
+
given, ScriptingAddition will use this instead
|
|
109
|
+
of retrieving the terminology dynamically
|
|
110
|
+
|
|
111
|
+
Methods:
|
|
112
|
+
|
|
113
|
+
# Introspection:
|
|
114
|
+
|
|
115
|
+
commands -- returns names of all available commands
|
|
116
|
+
|
|
117
|
+
parameters(command_name) -- returns a command's parameter names
|
|
118
|
+
|
|
119
|
+
# Specifying a different target application:
|
|
120
|
+
|
|
121
|
+
# Each of the following methods returns a new ScriptingAddition
|
|
122
|
+
# instance targeted at the specified application. The arguments
|
|
123
|
+
# are the same as for the by_name, by_creator, etc. methods in
|
|
124
|
+
# appscript.
|
|
125
|
+
|
|
126
|
+
by_name(name) -- name or full path of application, e.g. "Finder"
|
|
127
|
+
|
|
128
|
+
by_creator(creator) -- four-character creator code, e.g. "ttxt"
|
|
129
|
+
|
|
130
|
+
by_id(id) -- bundle id, e.g. "com.apple.ical"
|
|
131
|
+
|
|
132
|
+
by_pid(pid) -- Unix process ID, e.g. 4005
|
|
133
|
+
|
|
134
|
+
by_url(url) -- eppc URL, e.g. "eppc://jukebox-mac.local/iTunes"</code></pre>
|
|
135
|
+
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
<!-- bottom navigation -->
|
|
139
|
+
|
|
140
|
+
<div class="footer">
|
|
141
|
+
<a href="01_introduction.html">Previous</a> •
|
|
142
|
+
<a href="index.html">Up</a> •
|
|
143
|
+
<a href="03_examples.html">Next</a>
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
</body>
|
|
147
|
+
</html>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
|
|
5
|
+
<title>rb-osax manual | 3. Examples</title>
|
|
6
|
+
|
|
7
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
8
|
+
<style type="text/css" media="all"><!--@import url(../full.css);--></style>
|
|
9
|
+
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
|
|
13
|
+
<h1><img src="../rb-appscript-logo.png" alt="rb-appscript" title="rb-appscript" /></h1>
|
|
14
|
+
|
|
15
|
+
<!-- top navigation -->
|
|
16
|
+
<div class="navbar">
|
|
17
|
+
<a href="02_interface.html">Previous</a> •
|
|
18
|
+
<a href="index.html">Up</a> •
|
|
19
|
+
<a href="04_notes.html">Next</a>
|
|
20
|
+
|
|
21
|
+
<span>
|
|
22
|
+
<a href="../appscript-manual/index.html">appscript</a> /
|
|
23
|
+
<a href="../mactypes-manual/index.html">mactypes</a> /
|
|
24
|
+
<strong><a href="../osax-manual/index.html">osax</a></strong> /
|
|
25
|
+
<a href="../aem-manual/index.html">aem</a>
|
|
26
|
+
</span>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<!-- content -->
|
|
30
|
+
<div id="content">
|
|
31
|
+
|
|
32
|
+
<h2>3. Examples</h2>
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
<pre><code>require "osax"
|
|
36
|
+
|
|
37
|
+
# Create a new ScriptingAddition object:
|
|
38
|
+
|
|
39
|
+
sa = OSAX.osax
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# List all available commands:
|
|
43
|
+
|
|
44
|
+
p sa.commands
|
|
45
|
+
# Result: ["ASCII_character", "ASCII_number", "activate", ...]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# Call some commands:
|
|
49
|
+
|
|
50
|
+
sa.beep
|
|
51
|
+
|
|
52
|
+
p sa.path_to(:scripts_folder)
|
|
53
|
+
# Result: MacTypes::Alias.at("/Users/foo/Library/Scripts/")
|
|
54
|
+
|
|
55
|
+
p sa.display_dialog("Ruby says hello!",
|
|
56
|
+
:buttons=>["Hi!", "Howdy!", "Duuuude!"],
|
|
57
|
+
:default_button=>3)
|
|
58
|
+
# Result: {:button_returned=>"Howdy!"}</code></pre>
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<!-- bottom navigation -->
|
|
65
|
+
|
|
66
|
+
<div class="footer">
|
|
67
|
+
<a href="02_interface.html">Previous</a> •
|
|
68
|
+
<a href="index.html">Up</a> •
|
|
69
|
+
<a href="04_notes.html">Next</a>
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
</body>
|
|
73
|
+
</html>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
|
|
5
|
+
<title>rb-osax manual | 4. Notes</title>
|
|
6
|
+
|
|
7
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
8
|
+
<style type="text/css" media="all"><!--@import url(../full.css);--></style>
|
|
9
|
+
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
|
|
13
|
+
<h1><img src="../rb-appscript-logo.png" alt="rb-appscript" title="rb-appscript" /></h1>
|
|
14
|
+
|
|
15
|
+
<!-- top navigation -->
|
|
16
|
+
<div class="navbar">
|
|
17
|
+
<a href="03_examples.html">Previous</a> •
|
|
18
|
+
<a href="index.html">Up</a>
|
|
19
|
+
|
|
20
|
+
<span>
|
|
21
|
+
<a href="../appscript-manual/index.html">appscript</a> /
|
|
22
|
+
<a href="../mactypes-manual/index.html">mactypes</a> /
|
|
23
|
+
<strong><a href="../osax-manual/index.html">osax</a></strong> /
|
|
24
|
+
<a href="../aem-manual/index.html">aem</a>
|
|
25
|
+
</span>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<!-- content -->
|
|
29
|
+
<div id="content">
|
|
30
|
+
|
|
31
|
+
<h2>4. Notes</h2>
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
<h3>Event loops</h3>
|
|
35
|
+
|
|
36
|
+
<p>Ruby-based applications that use a Carbon/Cocoa event loop can import the <code>OSAX</code> module as normal, but should not use it before the event loop has started as sending Apple events outwith the main event loop can disrupt the process's normal event handling.</p>
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
<h3>GUI interaction</h3>
|
|
40
|
+
|
|
41
|
+
<p>When using scripting addition commands that require GUI access (e.g. <code>display_dialog</code>) targeted at the command-line Ruby interpreter, the osax module will automatically convert the non-GUI interpreter process into a full GUI process to allow these commands to operate correctly. If you want to avoid this, target these commands at a faceless GUI application such as System Events instead:</p>
|
|
42
|
+
|
|
43
|
+
<pre><code>sa = OSAX.osax("StandardAdditions", "System Events")
|
|
44
|
+
sa.activate # give focus to System Events
|
|
45
|
+
p sa.display_dialog("Ruby says hello!",
|
|
46
|
+
:buttons=>["Hi!", "Howdy!", "Duuuude!"],
|
|
47
|
+
:default_button=>3)
|
|
48
|
+
# Result: {:button_returned=>"Duuuude!"}</code></pre>
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<!-- bottom navigation -->
|
|
54
|
+
|
|
55
|
+
<div class="footer">
|
|
56
|
+
<a href="03_examples.html">Previous</a> •
|
|
57
|
+
<a href="index.html">Up</a>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
</body>
|
|
61
|
+
</html>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
|
|
5
|
+
<title>rb-osax manual</title>
|
|
6
|
+
|
|
7
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
8
|
+
<style type="text/css" media="all"><!--@import url(../full.css);--></style>
|
|
9
|
+
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
|
|
13
|
+
<h1><img src="../rb-appscript-logo.png" alt="rb-appscript" title="rb-appscript" /></h1>
|
|
14
|
+
|
|
15
|
+
<!-- top navigation -->
|
|
16
|
+
<div class="navbar">
|
|
17
|
+
<a href="../index.html">Previous</a> •
|
|
18
|
+
<a href="../index.html">Up</a> •
|
|
19
|
+
<a href="01_introduction.html">Next</a>
|
|
20
|
+
|
|
21
|
+
<span>
|
|
22
|
+
<a href="../appscript-manual/index.html">appscript</a> /
|
|
23
|
+
<a href="../mactypes-manual/index.html">mactypes</a> /
|
|
24
|
+
<strong><a href="../osax-manual/index.html">osax</a></strong> /
|
|
25
|
+
<a href="../aem-manual/index.html">aem</a>
|
|
26
|
+
</span>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<!-- content -->
|
|
30
|
+
<div id="content">
|
|
31
|
+
|
|
32
|
+
<h2>Contents</h2>
|
|
33
|
+
|
|
34
|
+
<ol>
|
|
35
|
+
<li><a href="01_introduction.html">Introduction</a></li>
|
|
36
|
+
<li><a href="02_interface.html">Interface</a></li>
|
|
37
|
+
<li><a href="03_examples.html">Examples</a></li>
|
|
38
|
+
<li><a href="04_notes.html">Notes</a></li>
|
|
39
|
+
|
|
40
|
+
</ol>
|
|
41
|
+
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<!-- bottom navigation -->
|
|
45
|
+
|
|
46
|
+
<div class="footer">
|
|
47
|
+
<a href="../index.html">Previous</a> •
|
|
48
|
+
<a href="../index.html">Up</a> •
|
|
49
|
+
<a href="01_introduction.html">Next</a>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
</body>
|
|
53
|
+
</html>
|