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,164 @@
|
|
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-aem manual | 5. Targeting Applications</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="04_references.html">Previous</a> •
|
18
|
+
<a href="index.html">Up</a> •
|
19
|
+
<a href="06_buildingandsendingevents.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
|
+
<a href="../osax-manual/index.html">osax</a> /
|
25
|
+
<strong><a href="../aem-manual/index.html">aem</a></strong>
|
26
|
+
</span>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<!-- content -->
|
30
|
+
<div id="content">
|
31
|
+
|
32
|
+
<h2>5. Targeting Applications</h2>
|
33
|
+
|
34
|
+
<h3>The <code>Application</code> class</h3>
|
35
|
+
|
36
|
+
<p>The <code>Application</code> class represents an application to which Apple events will be sent. Its constructor allows applications to be identified in one of four ways: by full path, by eppc URL, by custom <code>AEAddressDesc</code>, or the host application if no other value is given. Its main method, <code>#event</code>, is used to construct the Apple events to send. Several utility methods are also provided.</p>
|
37
|
+
|
38
|
+
<pre><code>Application -- the target application
|
39
|
+
|
40
|
+
Class methods:
|
41
|
+
|
42
|
+
process_exists_for_path?(path) -- Does a local process launched
|
43
|
+
from the specified application file exist?
|
44
|
+
path : string -- application's path, e.g. '/Applications/iCal.app'
|
45
|
+
Result : boolean -- Note: if path is invalid, an AE::MacOSError
|
46
|
+
is raised.
|
47
|
+
|
48
|
+
process_exists_for_pid?(pid) -- Is there a local application process
|
49
|
+
with the given Unix process id?
|
50
|
+
pid : integer
|
51
|
+
Result : boolean
|
52
|
+
|
53
|
+
process_exists_for_url?(url) -- Does an application process specified
|
54
|
+
by the given eppc:// URL exist?
|
55
|
+
url : string -- url for remote process
|
56
|
+
(e.g. 'eppc://user:pass@0.0.0.1/TextEdit')
|
57
|
+
Result : boolean -- Returns false if process doesn't exist, or if
|
58
|
+
access isn't allowed.
|
59
|
+
|
60
|
+
process_exists_for_desc?(desc) -- Does an application process specified
|
61
|
+
by the given AEAddressDesc exist?
|
62
|
+
desc : AE::AEDesc -- AEAddressDesc for application
|
63
|
+
Result : boolean -- Returns false if process doesn't exist, or if
|
64
|
+
access isn't allowed.
|
65
|
+
|
66
|
+
launch(path) -- launch an application in background if not
|
67
|
+
already running, and send it a 'ascrnoop' event
|
68
|
+
path : string -- application's path, e.g. '/Applications/iCal.app'
|
69
|
+
|
70
|
+
Constructors:
|
71
|
+
|
72
|
+
by_path(path)
|
73
|
+
path : string -- full path to local application
|
74
|
+
(e.g. '/Applications/TextEdit.app')
|
75
|
+
|
76
|
+
by_pid(pid)
|
77
|
+
pid : integer -- Unix process id
|
78
|
+
|
79
|
+
by_url(url)
|
80
|
+
url : string -- url for remote process
|
81
|
+
(e.g. 'eppc://user:pass@0.0.0.1/TextEdit')
|
82
|
+
|
83
|
+
by_desc(desc)
|
84
|
+
desc : AEDesc -- AEAddressDesc for application
|
85
|
+
|
86
|
+
current -- the host process
|
87
|
+
|
88
|
+
Methods:
|
89
|
+
|
90
|
+
event(...) -- construct an Apple event (see next chapter for details)
|
91
|
+
|
92
|
+
begin_transaction(session=nil) -- begin a new transaction;
|
93
|
+
all Events constructed after begin_transaction is
|
94
|
+
called will belong to the same transaction until
|
95
|
+
end_transaction or abort_transaction is called
|
96
|
+
session : anything -- optional value identifying the
|
97
|
+
specific session (where supported)
|
98
|
+
|
99
|
+
end_transaction -- end the current transaction
|
100
|
+
|
101
|
+
abort_transaction -- abort the current transaction
|
102
|
+
|
103
|
+
reconnect -- Make sure this Application object has a valid
|
104
|
+
AEAddressDesc for the target application, relaunching
|
105
|
+
the target application if it's not currently running.
|
106
|
+
(Note: this only works for Application objects created
|
107
|
+
via the by_path constructor.)</code></pre>
|
108
|
+
|
109
|
+
|
110
|
+
<h3>Creating <code>Application</code> objects</h3>
|
111
|
+
|
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
|
+
|
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
|
+
|
116
|
+
<p>Clients can also supply their own <code>AEAddressDesc</code> if they prefer. This should be an <code>AE::AEDesc</code> of one of the following types:</p>
|
117
|
+
|
118
|
+
<pre><code>KAE::TypeApplicationBundleID
|
119
|
+
KAE::TypeApplicationURL
|
120
|
+
KAE::TypeApplSignature
|
121
|
+
KAE::TypeKernelProcessID
|
122
|
+
KAE::TypeMachPort
|
123
|
+
KAE::TypeProcessSerialNumber</code></pre>
|
124
|
+
|
125
|
+
<p>See the Apple Event Manager documentation for more information on these addressing modes.</p>
|
126
|
+
|
127
|
+
|
128
|
+
<h3>Launching applications</h3>
|
129
|
+
|
130
|
+
<p><code>Application.launch</code> is a class method attached to the <code>Application</code> class for convenience. It allows a non-running application to be launched without sending it the 'run' event (<code>aevtoapp</code>) normally sent to applications - a 'no-op' event (<code>ascrnoop</code>) is sent instead. It should be called before creating an <code>Application</code> object for the target application, otherwise the application will be launched as normal.</p>
|
131
|
+
|
132
|
+
|
133
|
+
<h3>Transactions</h3>
|
134
|
+
|
135
|
+
<p>The <code>#begin_transaction</code> and <code>#end_transaction</code> methods are used to start and stop transaction sessions for applications that support this. All events <em>created</em> while a transaction session is active will be identified as part of that transaction.</p>
|
136
|
+
|
137
|
+
<p>Note that during a transaction, sending the application an event not created during that transaction will cause an error. Similarly, sending the application an event created during a transaction after that transaction has ended will cause an error.</p>
|
138
|
+
|
139
|
+
<p>The <code>#end_transaction</code> method must be called to close both successful and failed transactions on completion. If a transaction session is accidentally left open, aem will attempt to close it when the <code>Application</code> object is garbage-collected, although this cannot be guaranteed to succeed.</p>
|
140
|
+
|
141
|
+
|
142
|
+
<h3>Reconnecting to local applications</h3>
|
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>EventError</code> -600 ("application isn't running") or -609 ("connection is invalid") to be raised.</p>
|
145
|
+
|
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
|
+
|
148
|
+
<p>Calling the <code>#reconnect</code> method will create a new <code>AEAddressDesc</code> for an existing <code>Application</code> object that was originally created via the <code>by_path</code> constructor. If the application is not running at the time, it will be started automatically.</p>
|
149
|
+
|
150
|
+
<p>Note that only <code>Event</code> instances created after <code>#reconnect</code> is called will receive the new <code>AEAddressDesc</code>. Any <code>Event</code> instances created before <code>reconnect</code> is called will still contain the old <code>AEAddressDesc</code>.</p>
|
151
|
+
|
152
|
+
|
153
|
+
</div>
|
154
|
+
|
155
|
+
<!-- bottom navigation -->
|
156
|
+
|
157
|
+
<div class="footer">
|
158
|
+
<a href="04_references.html">Previous</a> •
|
159
|
+
<a href="index.html">Up</a> •
|
160
|
+
<a href="06_buildingandsendingevents.html">Next</a>
|
161
|
+
</div>
|
162
|
+
|
163
|
+
</body>
|
164
|
+
</html>
|
@@ -0,0 +1,229 @@
|
|
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-aem manual | 6. Building and sending events</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="05_targetingapplications.html">Previous</a> •
|
18
|
+
<a href="index.html">Up</a> •
|
19
|
+
<a href="07_findapp.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
|
+
<a href="../osax-manual/index.html">osax</a> /
|
25
|
+
<strong><a href="../aem-manual/index.html">aem</a></strong>
|
26
|
+
</span>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<!-- content -->
|
30
|
+
<div id="content">
|
31
|
+
|
32
|
+
<h2>6. Building and sending events</h2>
|
33
|
+
|
34
|
+
|
35
|
+
<h3>The <code>Application#event</code> method</h3>
|
36
|
+
|
37
|
+
<p>The <code>Application#event</code> method is used to create new Apple events targetted at the specified application.</p>
|
38
|
+
|
39
|
+
<pre><code>Application -- the target application
|
40
|
+
...
|
41
|
+
|
42
|
+
event(event_code, params={}, atts={}, return_id=KAE::KAutoGenerateReturnID,
|
43
|
+
codecs=DefaultCodecs) -- construct an Apple event
|
44
|
+
event_code : string -- 8-letter code indicating event's class and id,
|
45
|
+
e.g. 'coregetd'
|
46
|
+
params : hash -- a hash of form {AE_code=>anything,...} containing
|
47
|
+
zero or more event parameters
|
48
|
+
atts : hash -- a hash of form {AE_code=>anything,...} containing
|
49
|
+
zero or more event attributes
|
50
|
+
return_id : integer -- reply event's ID
|
51
|
+
codecs : Codecs -- codecs object to use when packing/unpacking
|
52
|
+
attributes and parameters for this event and its reply
|
53
|
+
Result : Event -- a ready-to-send Apple event</code></pre>
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
<h3>The <code>Event</code> class</h3>
|
58
|
+
|
59
|
+
<p>The <code>Event</code> class represents an Apple event that has been packed and is ready to send.</p>
|
60
|
+
|
61
|
+
<pre><code>Event
|
62
|
+
|
63
|
+
Methods:
|
64
|
+
|
65
|
+
send(timeout=KAE::KDefaultTimeout, flags=KAE::KAEWaitReply) -- send event
|
66
|
+
timeout : integer | KAE::KDefaultTimeout | KAE::KNoTimeOut -- number of
|
67
|
+
ticks to wait for application reply before raising timeout error
|
68
|
+
flags : integer -- bitwise flags determining how event should be
|
69
|
+
handled
|
70
|
+
Result : anything -- value returned by application, if any</code></pre>
|
71
|
+
|
72
|
+
|
73
|
+
<p>The <code>send</code> method may be called any number of times.</p>
|
74
|
+
|
75
|
+
|
76
|
+
<h3>Constants</h3>
|
77
|
+
|
78
|
+
<p>The following constants are defined in the <code>KAE</code> module.</p>
|
79
|
+
|
80
|
+
<h4>Common parameter keys</h4>
|
81
|
+
|
82
|
+
<pre><code>KAE::KeyDirectObject
|
83
|
+
KAE::KeyAERequestedType</code></pre>
|
84
|
+
|
85
|
+
<p>(The value for a <code>keyAERequestedType</code> parameter should be an <code>AEType</code> instance.)</p>
|
86
|
+
|
87
|
+
<p>Other parameter keys are defined by individual applications.</p>
|
88
|
+
|
89
|
+
|
90
|
+
<h4>Attribute keys</h4>
|
91
|
+
|
92
|
+
<p>Most of the following attributes are already supplied by other means (e.g. keyEventClassAttr, keyEventIDAttr are supplied separately when creating an Apple event; keyTimeoutAttr when sending it) and are only of interest if unpacking AppleEvent descriptors manually. A few may be used when passing an attributes dict to <code>Application#event</code> (<code>EnumConsiderations</code>, <code>EnumConsidsAndIgnores</code>, <code>KeySubjectAttr</code>):</p>
|
93
|
+
|
94
|
+
<pre><code>KAE::KeyTransactionIDAttr
|
95
|
+
KAE::KeyReturnIDAttr
|
96
|
+
KAE::KeyEventClassAttr
|
97
|
+
KAE::KeyEventIDAttr
|
98
|
+
KAE::KeyAddressAttr
|
99
|
+
KAE::KeyOptionalKeywordAttr
|
100
|
+
KAE::KeyTimeoutAttr
|
101
|
+
KAE::KeyInteractLevelAttr
|
102
|
+
KAE::KeyEventSourceAttr
|
103
|
+
KAE::KeyOriginalAddressAttr
|
104
|
+
KAE::KeyAcceptTimeoutAttr
|
105
|
+
KAE::EnumConsiderations
|
106
|
+
KAE::EnumConsidsAndIgnores
|
107
|
+
KAE::KeySubjectAttr</code></pre>
|
108
|
+
|
109
|
+
|
110
|
+
<p>The value of the <code>EnumConsiderations</code> attribute should be a list containing zero or more <code>AEEnum</code> instances with the following codes:</p>
|
111
|
+
|
112
|
+
<pre><code>KAE::KAECase
|
113
|
+
KAE::KAEDiacritic
|
114
|
+
KAE::KAEWhiteSpace
|
115
|
+
KAE::KAEHyphens
|
116
|
+
KAE::KAEExpansion
|
117
|
+
KAE::KAEPunctuation
|
118
|
+
KAE::KASConsiderReplies
|
119
|
+
KAE::KASNumericStrings</code></pre>
|
120
|
+
|
121
|
+
<p>See the <a href="http://developer.apple.com/documentation/Carbon/Reference/Apple_Event_Manager/index.html">Apple Event Manager</a> API reference for more info. Note that the <code>EnumConsiderations</code> attribute is deprecated in favour of the <code>EnumConsidsAndIgnores</code> attribute.</p>
|
122
|
+
|
123
|
+
|
124
|
+
<p>The value of the <code>EnumConsidsAndIgnores</code> attribute should be an integer composed from the sum of zero or more of the following bit masks:</p>
|
125
|
+
|
126
|
+
<pre><code>KAE::KAECaseConsiderMask
|
127
|
+
KAE::KAEDiacriticConsiderMask
|
128
|
+
KAE::KAEWhiteSpaceConsiderMask
|
129
|
+
KAE::KAEHyphensConsiderMask
|
130
|
+
KAE::KAEExpansionConsiderMask
|
131
|
+
KAE::KAEPunctuationConsiderMask
|
132
|
+
KAE::KASConsiderRepliesConsiderMask
|
133
|
+
KAE::KASNumericStringsConsiderMask
|
134
|
+
|
135
|
+
KAE::KAECaseIgnoreMask
|
136
|
+
KAE::KAEDiacriticIgnoreMask
|
137
|
+
KAE::KAEWhiteSpaceIgnoreMask
|
138
|
+
KAE::KAEHyphensIgnoreMask
|
139
|
+
KAE::KAEExpansionIgnoreMask
|
140
|
+
KAE::KAEPunctuationIgnoreMask
|
141
|
+
KAE::KASConsiderRepliesIgnoreMask
|
142
|
+
KAE::KASNumericStringsIgnoreMask</code></pre>
|
143
|
+
|
144
|
+
|
145
|
+
<h4>Send flag constants</h4>
|
146
|
+
|
147
|
+
<p>The value of the <code>send</code> method's <code>flags</code> argument should be an integer composed from the sum of zero or more of the following bit masks:</p>
|
148
|
+
|
149
|
+
<pre><code>KAE::KAENoReply
|
150
|
+
KAE::KAEQueueReply
|
151
|
+
KAE::KAEWaitReply
|
152
|
+
|
153
|
+
KAE::KAEDontReconnect
|
154
|
+
|
155
|
+
KAE::KAEWantReceipt
|
156
|
+
|
157
|
+
KAE::KAENeverInteract
|
158
|
+
KAE::KAECanInteract
|
159
|
+
KAE::KAEAlwaysInteract
|
160
|
+
|
161
|
+
KAE::KAECanSwitchLayer</code></pre>
|
162
|
+
|
163
|
+
<p>See the <a href="http://developer.apple.com/documentation/Carbon/Reference/Apple_Event_Manager/apple_event_manager_ref/chapter_1.4_section_6.html">Apple Event Manager</a> API reference for details.</p>
|
164
|
+
|
165
|
+
|
166
|
+
<h4>Other constants</h4>
|
167
|
+
|
168
|
+
<pre><code>KAE::KAutoGenerateReturnID</code></pre>
|
169
|
+
|
170
|
+
|
171
|
+
<h3>Exception classes</h3>
|
172
|
+
|
173
|
+
<h4>The <code>EventError</code> class</h4>
|
174
|
+
|
175
|
+
<p>The <code>EventError</code> class is raised by <code>Event#send</code> and represents an error raised by the target application or Apple Event Manager when sending an event.</p>
|
176
|
+
|
177
|
+
<pre><code>EventError < RuntimeError
|
178
|
+
|
179
|
+
Methods:
|
180
|
+
|
181
|
+
number
|
182
|
+
Result: integer -- Mac OS error number
|
183
|
+
|
184
|
+
message
|
185
|
+
Result: string | nil -- application-supplied/generic
|
186
|
+
error description
|
187
|
+
|
188
|
+
offending_object
|
189
|
+
Result: anything | nil -- object that caused the error,
|
190
|
+
if given by application
|
191
|
+
|
192
|
+
expected_type
|
193
|
+
Result: anything | nil -- object that caused a coercion
|
194
|
+
error, if given by application
|
195
|
+
|
196
|
+
partial_result
|
197
|
+
Result: anything | nil -- part of return value constructed
|
198
|
+
before error occurred, if given by application
|
199
|
+
|
200
|
+
to_i -- Mac OS error number
|
201
|
+
|
202
|
+
to_s -- formatted description of error</code></pre>
|
203
|
+
|
204
|
+
|
205
|
+
<h4><code>AE::MacOSError</code></h4>
|
206
|
+
|
207
|
+
<p>The <code>AE::MacOSError</code> exception is raised by the low-level <code>AE</code> extension and represents an error raised by the Apple Event Manager. The <code>AEM</code> API usually traps these low-level errors and throws more descriptive errors in their place (e.g. <code>AEM::EventError</code>).</p>
|
208
|
+
|
209
|
+
<pre><code>MacOSError < StandardError
|
210
|
+
|
211
|
+
Methods:
|
212
|
+
number
|
213
|
+
Result: integer -- the Mac OS error number
|
214
|
+
|
215
|
+
description
|
216
|
+
Result: string -- short generic error description</code></pre>
|
217
|
+
|
218
|
+
</div>
|
219
|
+
|
220
|
+
<!-- bottom navigation -->
|
221
|
+
|
222
|
+
<div class="footer">
|
223
|
+
<a href="05_targetingapplications.html">Previous</a> •
|
224
|
+
<a href="index.html">Up</a> •
|
225
|
+
<a href="07_findapp.html">Next</a>
|
226
|
+
</div>
|
227
|
+
|
228
|
+
</body>
|
229
|
+
</html>
|
@@ -0,0 +1,63 @@
|
|
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-aem manual | 7. Locating applications</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="06_buildingandsendingevents.html">Previous</a> •
|
18
|
+
<a href="index.html">Up</a> •
|
19
|
+
<a href="08_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
|
+
<a href="../osax-manual/index.html">osax</a> /
|
25
|
+
<strong><a href="../aem-manual/index.html">aem</a></strong>
|
26
|
+
</span>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<!-- content -->
|
30
|
+
<div id="content">
|
31
|
+
|
32
|
+
<h2>7. Locating applications</h2>
|
33
|
+
|
34
|
+
<h3>The <code>FindApp</code> module</h3>
|
35
|
+
|
36
|
+
<p>The <code>FindApp</code> module is used to obtain the full path to an application given its file name, bundle ID, or creator code. It exports the following methods:</p>
|
37
|
+
|
38
|
+
<pre><code>by_name(name) -- Find the application with the given name.
|
39
|
+
name : string -- application's name, e.g. 'Finder.app'. The '.app' suffix
|
40
|
+
is optional. Absolute paths are also accepted.
|
41
|
+
Result : string -- full path to application
|
42
|
+
|
43
|
+
by_id(id) -- Find the application with the given bundle id.
|
44
|
+
id : string -- bundle id, e.g. 'com.apple.textedit'
|
45
|
+
Result : string -- full path to application
|
46
|
+
|
47
|
+
by_creator(creator) -- Find the application with the given creator type.
|
48
|
+
creator : string -- four-char code, e.g. 'ttxt'
|
49
|
+
Result : string -- full path to application</code></pre>
|
50
|
+
|
51
|
+
|
52
|
+
</div>
|
53
|
+
|
54
|
+
<!-- bottom navigation -->
|
55
|
+
|
56
|
+
<div class="footer">
|
57
|
+
<a href="06_buildingandsendingevents.html">Previous</a> •
|
58
|
+
<a href="index.html">Up</a> •
|
59
|
+
<a href="08_examples.html">Next</a>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
</body>
|
63
|
+
</html>
|