|
1 """Suite Standard Suite: Common classes and commands for most applications. |
|
2 Level 1, version 1 |
|
3 |
|
4 Generated from /Applications/Utilities/Terminal.app |
|
5 AETE/AEUT resource version 1/0, language 0, script 0 |
|
6 """ |
|
7 |
|
8 import aetools |
|
9 import MacOS |
|
10 |
|
11 _code = '????' |
|
12 |
|
13 class Standard_Suite_Events: |
|
14 |
|
15 _argmap_close = { |
|
16 'saving_in' : 'kfil', |
|
17 'saving' : 'savo', |
|
18 } |
|
19 |
|
20 def close(self, _object, _attributes={}, **_arguments): |
|
21 """close: Close an object. |
|
22 Required argument: the object for the command |
|
23 Keyword argument saving_in: The file in which to save the object. |
|
24 Keyword argument saving: Specifies whether changes should be saved before closing. |
|
25 Keyword argument _attributes: AppleEvent attribute dictionary |
|
26 """ |
|
27 _code = 'core' |
|
28 _subcode = 'clos' |
|
29 |
|
30 aetools.keysubst(_arguments, self._argmap_close) |
|
31 _arguments['----'] = _object |
|
32 |
|
33 aetools.enumsubst(_arguments, 'savo', _Enum_savo) |
|
34 |
|
35 _reply, _arguments, _attributes = self.send(_code, _subcode, |
|
36 _arguments, _attributes) |
|
37 if _arguments.get('errn', 0): |
|
38 raise aetools.Error, aetools.decodeerror(_arguments) |
|
39 # XXXX Optionally decode result |
|
40 if _arguments.has_key('----'): |
|
41 return _arguments['----'] |
|
42 |
|
43 _argmap_count = { |
|
44 'each' : 'kocl', |
|
45 } |
|
46 |
|
47 def count(self, _object, _attributes={}, **_arguments): |
|
48 """count: Return the number of elements of a particular class within an object. |
|
49 Required argument: the object for the command |
|
50 Keyword argument each: The class of objects to be counted. |
|
51 Keyword argument _attributes: AppleEvent attribute dictionary |
|
52 Returns: the reply for the command |
|
53 """ |
|
54 _code = 'core' |
|
55 _subcode = 'cnte' |
|
56 |
|
57 aetools.keysubst(_arguments, self._argmap_count) |
|
58 _arguments['----'] = _object |
|
59 |
|
60 |
|
61 _reply, _arguments, _attributes = self.send(_code, _subcode, |
|
62 _arguments, _attributes) |
|
63 if _arguments.get('errn', 0): |
|
64 raise aetools.Error, aetools.decodeerror(_arguments) |
|
65 # XXXX Optionally decode result |
|
66 if _arguments.has_key('----'): |
|
67 return _arguments['----'] |
|
68 |
|
69 def delete(self, _object, _attributes={}, **_arguments): |
|
70 """delete: Delete an object. |
|
71 Required argument: the object for the command |
|
72 Keyword argument _attributes: AppleEvent attribute dictionary |
|
73 """ |
|
74 _code = 'core' |
|
75 _subcode = 'delo' |
|
76 |
|
77 if _arguments: raise TypeError, 'No optional args expected' |
|
78 _arguments['----'] = _object |
|
79 |
|
80 |
|
81 _reply, _arguments, _attributes = self.send(_code, _subcode, |
|
82 _arguments, _attributes) |
|
83 if _arguments.get('errn', 0): |
|
84 raise aetools.Error, aetools.decodeerror(_arguments) |
|
85 # XXXX Optionally decode result |
|
86 if _arguments.has_key('----'): |
|
87 return _arguments['----'] |
|
88 |
|
89 _argmap_duplicate = { |
|
90 'to' : 'insh', |
|
91 'with_properties' : 'prdt', |
|
92 } |
|
93 |
|
94 def duplicate(self, _object, _attributes={}, **_arguments): |
|
95 """duplicate: Copy object(s) and put the copies at a new location. |
|
96 Required argument: the object for the command |
|
97 Keyword argument to: The location for the new object(s). |
|
98 Keyword argument with_properties: Properties to be set in the new duplicated object(s). |
|
99 Keyword argument _attributes: AppleEvent attribute dictionary |
|
100 """ |
|
101 _code = 'core' |
|
102 _subcode = 'clon' |
|
103 |
|
104 aetools.keysubst(_arguments, self._argmap_duplicate) |
|
105 _arguments['----'] = _object |
|
106 |
|
107 |
|
108 _reply, _arguments, _attributes = self.send(_code, _subcode, |
|
109 _arguments, _attributes) |
|
110 if _arguments.get('errn', 0): |
|
111 raise aetools.Error, aetools.decodeerror(_arguments) |
|
112 # XXXX Optionally decode result |
|
113 if _arguments.has_key('----'): |
|
114 return _arguments['----'] |
|
115 |
|
116 def exists(self, _object, _attributes={}, **_arguments): |
|
117 """exists: Verify if an object exists. |
|
118 Required argument: the object for the command |
|
119 Keyword argument _attributes: AppleEvent attribute dictionary |
|
120 Returns: the reply for the command |
|
121 """ |
|
122 _code = 'core' |
|
123 _subcode = 'doex' |
|
124 |
|
125 if _arguments: raise TypeError, 'No optional args expected' |
|
126 _arguments['----'] = _object |
|
127 |
|
128 |
|
129 _reply, _arguments, _attributes = self.send(_code, _subcode, |
|
130 _arguments, _attributes) |
|
131 if _arguments.get('errn', 0): |
|
132 raise aetools.Error, aetools.decodeerror(_arguments) |
|
133 # XXXX Optionally decode result |
|
134 if _arguments.has_key('----'): |
|
135 return _arguments['----'] |
|
136 |
|
137 def get(self, _object, _attributes={}, **_arguments): |
|
138 """get: Get the data for an object. |
|
139 Required argument: the object for the command |
|
140 Keyword argument _attributes: AppleEvent attribute dictionary |
|
141 Returns: the reply for the command |
|
142 """ |
|
143 _code = 'core' |
|
144 _subcode = 'getd' |
|
145 |
|
146 if _arguments: raise TypeError, 'No optional args expected' |
|
147 _arguments['----'] = _object |
|
148 |
|
149 |
|
150 _reply, _arguments, _attributes = self.send(_code, _subcode, |
|
151 _arguments, _attributes) |
|
152 if _arguments.get('errn', 0): |
|
153 raise aetools.Error, aetools.decodeerror(_arguments) |
|
154 # XXXX Optionally decode result |
|
155 if _arguments.has_key('----'): |
|
156 return _arguments['----'] |
|
157 |
|
158 _argmap_make = { |
|
159 'at' : 'insh', |
|
160 'new' : 'kocl', |
|
161 'with_data' : 'data', |
|
162 'with_properties' : 'prdt', |
|
163 } |
|
164 |
|
165 def make(self, _no_object=None, _attributes={}, **_arguments): |
|
166 """make: Make a new object. |
|
167 Keyword argument at: The location at which to insert the object. |
|
168 Keyword argument new: The class of the new object. |
|
169 Keyword argument with_data: The initial data for the object. |
|
170 Keyword argument with_properties: The initial values for properties of the object. |
|
171 Keyword argument _attributes: AppleEvent attribute dictionary |
|
172 Returns: the reply for the command |
|
173 """ |
|
174 _code = 'core' |
|
175 _subcode = 'crel' |
|
176 |
|
177 aetools.keysubst(_arguments, self._argmap_make) |
|
178 if _no_object is not None: raise TypeError, 'No direct arg expected' |
|
179 |
|
180 |
|
181 _reply, _arguments, _attributes = self.send(_code, _subcode, |
|
182 _arguments, _attributes) |
|
183 if _arguments.get('errn', 0): |
|
184 raise aetools.Error, aetools.decodeerror(_arguments) |
|
185 # XXXX Optionally decode result |
|
186 if _arguments.has_key('----'): |
|
187 return _arguments['----'] |
|
188 |
|
189 _argmap_move = { |
|
190 'to' : 'insh', |
|
191 } |
|
192 |
|
193 def move(self, _object, _attributes={}, **_arguments): |
|
194 """move: Move object(s) to a new location. |
|
195 Required argument: the object for the command |
|
196 Keyword argument to: The new location for the object(s). |
|
197 Keyword argument _attributes: AppleEvent attribute dictionary |
|
198 """ |
|
199 _code = 'core' |
|
200 _subcode = 'move' |
|
201 |
|
202 aetools.keysubst(_arguments, self._argmap_move) |
|
203 _arguments['----'] = _object |
|
204 |
|
205 |
|
206 _reply, _arguments, _attributes = self.send(_code, _subcode, |
|
207 _arguments, _attributes) |
|
208 if _arguments.get('errn', 0): |
|
209 raise aetools.Error, aetools.decodeerror(_arguments) |
|
210 # XXXX Optionally decode result |
|
211 if _arguments.has_key('----'): |
|
212 return _arguments['----'] |
|
213 |
|
214 def open(self, _object=None, _attributes={}, **_arguments): |
|
215 """open: Open an object. |
|
216 Required argument: list of objects |
|
217 Keyword argument _attributes: AppleEvent attribute dictionary |
|
218 """ |
|
219 _code = 'aevt' |
|
220 _subcode = 'odoc' |
|
221 |
|
222 if _arguments: raise TypeError, 'No optional args expected' |
|
223 _arguments['----'] = _object |
|
224 |
|
225 |
|
226 _reply, _arguments, _attributes = self.send(_code, _subcode, |
|
227 _arguments, _attributes) |
|
228 if _arguments.get('errn', 0): |
|
229 raise aetools.Error, aetools.decodeerror(_arguments) |
|
230 # XXXX Optionally decode result |
|
231 if _arguments.has_key('----'): |
|
232 return _arguments['----'] |
|
233 |
|
234 def print_(self, _object=None, _attributes={}, **_arguments): |
|
235 """print: Print an object. |
|
236 Required argument: list of objects |
|
237 Keyword argument _attributes: AppleEvent attribute dictionary |
|
238 """ |
|
239 _code = 'aevt' |
|
240 _subcode = 'pdoc' |
|
241 |
|
242 if _arguments: raise TypeError, 'No optional args expected' |
|
243 _arguments['----'] = _object |
|
244 |
|
245 |
|
246 _reply, _arguments, _attributes = self.send(_code, _subcode, |
|
247 _arguments, _attributes) |
|
248 if _arguments.get('errn', 0): |
|
249 raise aetools.Error, aetools.decodeerror(_arguments) |
|
250 # XXXX Optionally decode result |
|
251 if _arguments.has_key('----'): |
|
252 return _arguments['----'] |
|
253 |
|
254 _argmap_quit = { |
|
255 'saving' : 'savo', |
|
256 } |
|
257 |
|
258 def quit(self, _object, _attributes={}, **_arguments): |
|
259 """quit: Quit an application. |
|
260 Required argument: the object for the command |
|
261 Keyword argument saving: Specifies whether changes should be saved before quitting. |
|
262 Keyword argument _attributes: AppleEvent attribute dictionary |
|
263 """ |
|
264 _code = 'aevt' |
|
265 _subcode = 'quit' |
|
266 |
|
267 aetools.keysubst(_arguments, self._argmap_quit) |
|
268 _arguments['----'] = _object |
|
269 |
|
270 aetools.enumsubst(_arguments, 'savo', _Enum_savo) |
|
271 |
|
272 _reply, _arguments, _attributes = self.send(_code, _subcode, |
|
273 _arguments, _attributes) |
|
274 if _arguments.get('errn', 0): |
|
275 raise aetools.Error, aetools.decodeerror(_arguments) |
|
276 # XXXX Optionally decode result |
|
277 if _arguments.has_key('----'): |
|
278 return _arguments['----'] |
|
279 |
|
280 _argmap_save = { |
|
281 'in_' : 'kfil', |
|
282 'as' : 'fltp', |
|
283 } |
|
284 |
|
285 def save(self, _object, _attributes={}, **_arguments): |
|
286 """save: Save an object. |
|
287 Required argument: the object for the command |
|
288 Keyword argument in_: The file in which to save the object. |
|
289 Keyword argument as: The file type in which to save the data. |
|
290 Keyword argument _attributes: AppleEvent attribute dictionary |
|
291 """ |
|
292 _code = 'core' |
|
293 _subcode = 'save' |
|
294 |
|
295 aetools.keysubst(_arguments, self._argmap_save) |
|
296 _arguments['----'] = _object |
|
297 |
|
298 |
|
299 _reply, _arguments, _attributes = self.send(_code, _subcode, |
|
300 _arguments, _attributes) |
|
301 if _arguments.get('errn', 0): |
|
302 raise aetools.Error, aetools.decodeerror(_arguments) |
|
303 # XXXX Optionally decode result |
|
304 if _arguments.has_key('----'): |
|
305 return _arguments['----'] |
|
306 |
|
307 _argmap_set = { |
|
308 'to' : 'data', |
|
309 } |
|
310 |
|
311 def set(self, _object, _attributes={}, **_arguments): |
|
312 """set: Set an object's data. |
|
313 Required argument: the object for the command |
|
314 Keyword argument to: The new value. |
|
315 Keyword argument _attributes: AppleEvent attribute dictionary |
|
316 """ |
|
317 _code = 'core' |
|
318 _subcode = 'setd' |
|
319 |
|
320 aetools.keysubst(_arguments, self._argmap_set) |
|
321 _arguments['----'] = _object |
|
322 |
|
323 |
|
324 _reply, _arguments, _attributes = self.send(_code, _subcode, |
|
325 _arguments, _attributes) |
|
326 if _arguments.get('errn', 0): |
|
327 raise aetools.Error, aetools.decodeerror(_arguments) |
|
328 # XXXX Optionally decode result |
|
329 if _arguments.has_key('----'): |
|
330 return _arguments['----'] |
|
331 |
|
332 |
|
333 class application(aetools.ComponentItem): |
|
334 """application - An application's top level scripting object. """ |
|
335 want = 'capp' |
|
336 class _Prop__3c_Inheritance_3e_(aetools.NProperty): |
|
337 """<Inheritance> - All of the properties of the superclass. """ |
|
338 which = 'c@#^' |
|
339 want = 'cobj' |
|
340 _3c_Inheritance_3e_ = _Prop__3c_Inheritance_3e_() |
|
341 class _Prop_frontmost(aetools.NProperty): |
|
342 """frontmost - Is this the frontmost (active) application? """ |
|
343 which = 'pisf' |
|
344 want = 'bool' |
|
345 frontmost = _Prop_frontmost() |
|
346 class _Prop_name(aetools.NProperty): |
|
347 """name - The name of the application. """ |
|
348 which = 'pnam' |
|
349 want = 'utxt' |
|
350 name = _Prop_name() |
|
351 class _Prop_version(aetools.NProperty): |
|
352 """version - The version of the application. """ |
|
353 which = 'vers' |
|
354 want = 'utxt' |
|
355 version = _Prop_version() |
|
356 # element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID '] |
|
357 # element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] |
|
358 |
|
359 applications = application |
|
360 |
|
361 class item(aetools.ComponentItem): |
|
362 """item - A scriptable object. """ |
|
363 want = 'cobj' |
|
364 class _Prop_class_(aetools.NProperty): |
|
365 """class - The class of the object. """ |
|
366 which = 'pcls' |
|
367 want = 'type' |
|
368 class _Prop_properties(aetools.NProperty): |
|
369 """properties - All of the object's properties. """ |
|
370 which = 'pALL' |
|
371 want = 'reco' |
|
372 |
|
373 items = item |
|
374 |
|
375 class color(aetools.ComponentItem): |
|
376 """color - A color. """ |
|
377 want = 'colr' |
|
378 |
|
379 colors = color |
|
380 |
|
381 class window(aetools.ComponentItem): |
|
382 """window - A window. """ |
|
383 want = 'cwin' |
|
384 class _Prop_bounds(aetools.NProperty): |
|
385 """bounds - The bounding rectangle of the window. """ |
|
386 which = 'pbnd' |
|
387 want = 'qdrt' |
|
388 class _Prop_closeable(aetools.NProperty): |
|
389 """closeable - Whether the window has a close box. """ |
|
390 which = 'hclb' |
|
391 want = 'bool' |
|
392 class _Prop_document(aetools.NProperty): |
|
393 """document - The document whose contents are being displayed in the window. """ |
|
394 which = 'docu' |
|
395 want = 'docu' |
|
396 class _Prop_floating(aetools.NProperty): |
|
397 """floating - Whether the window floats. """ |
|
398 which = 'isfl' |
|
399 want = 'bool' |
|
400 class _Prop_id(aetools.NProperty): |
|
401 """id - The unique identifier of the window. """ |
|
402 which = 'ID ' |
|
403 want = 'long' |
|
404 class _Prop_index(aetools.NProperty): |
|
405 """index - The index of the window in the back-to-front window ordering. """ |
|
406 which = 'pidx' |
|
407 want = 'long' |
|
408 class _Prop_miniaturizable(aetools.NProperty): |
|
409 """miniaturizable - Whether the window can be miniaturized. """ |
|
410 which = 'ismn' |
|
411 want = 'bool' |
|
412 class _Prop_miniaturized(aetools.NProperty): |
|
413 """miniaturized - Whether the window is currently miniaturized. """ |
|
414 which = 'pmnd' |
|
415 want = 'bool' |
|
416 class _Prop_modal(aetools.NProperty): |
|
417 """modal - Whether the window is the application's current modal window. """ |
|
418 which = 'pmod' |
|
419 want = 'bool' |
|
420 class _Prop_resizable(aetools.NProperty): |
|
421 """resizable - Whether the window can be resized. """ |
|
422 which = 'prsz' |
|
423 want = 'bool' |
|
424 class _Prop_titled(aetools.NProperty): |
|
425 """titled - Whether the window has a title bar. """ |
|
426 which = 'ptit' |
|
427 want = 'bool' |
|
428 class _Prop_visible(aetools.NProperty): |
|
429 """visible - Whether the window is currently visible. """ |
|
430 which = 'pvis' |
|
431 want = 'bool' |
|
432 class _Prop_zoomable(aetools.NProperty): |
|
433 """zoomable - Whether the window can be zoomed. """ |
|
434 which = 'iszm' |
|
435 want = 'bool' |
|
436 class _Prop_zoomed(aetools.NProperty): |
|
437 """zoomed - Whether the window is currently zoomed. """ |
|
438 which = 'pzum' |
|
439 want = 'bool' |
|
440 |
|
441 windows = window |
|
442 |
|
443 class document(aetools.ComponentItem): |
|
444 """document - A document. """ |
|
445 want = 'docu' |
|
446 class _Prop_modified(aetools.NProperty): |
|
447 """modified - Has the document been modified since the last save? """ |
|
448 which = 'imod' |
|
449 want = 'bool' |
|
450 class _Prop_path(aetools.NProperty): |
|
451 """path - The document's path. """ |
|
452 which = 'ppth' |
|
453 want = 'utxt' |
|
454 |
|
455 documents = document |
|
456 application._superclassnames = ['item'] |
|
457 application._privpropdict = { |
|
458 '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, |
|
459 'frontmost' : _Prop_frontmost, |
|
460 'name' : _Prop_name, |
|
461 'version' : _Prop_version, |
|
462 } |
|
463 application._privelemdict = { |
|
464 'document' : document, |
|
465 'window' : window, |
|
466 } |
|
467 item._superclassnames = [] |
|
468 item._privpropdict = { |
|
469 'class_' : _Prop_class_, |
|
470 'properties' : _Prop_properties, |
|
471 } |
|
472 item._privelemdict = { |
|
473 } |
|
474 color._superclassnames = ['item'] |
|
475 color._privpropdict = { |
|
476 '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, |
|
477 } |
|
478 color._privelemdict = { |
|
479 } |
|
480 window._superclassnames = ['item'] |
|
481 window._privpropdict = { |
|
482 '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, |
|
483 'bounds' : _Prop_bounds, |
|
484 'closeable' : _Prop_closeable, |
|
485 'document' : _Prop_document, |
|
486 'floating' : _Prop_floating, |
|
487 'id' : _Prop_id, |
|
488 'index' : _Prop_index, |
|
489 'miniaturizable' : _Prop_miniaturizable, |
|
490 'miniaturized' : _Prop_miniaturized, |
|
491 'modal' : _Prop_modal, |
|
492 'name' : _Prop_name, |
|
493 'resizable' : _Prop_resizable, |
|
494 'titled' : _Prop_titled, |
|
495 'visible' : _Prop_visible, |
|
496 'zoomable' : _Prop_zoomable, |
|
497 'zoomed' : _Prop_zoomed, |
|
498 } |
|
499 window._privelemdict = { |
|
500 } |
|
501 document._superclassnames = ['item'] |
|
502 document._privpropdict = { |
|
503 '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, |
|
504 'modified' : _Prop_modified, |
|
505 'name' : _Prop_name, |
|
506 'path' : _Prop_path, |
|
507 } |
|
508 document._privelemdict = { |
|
509 } |
|
510 class _3c_(aetools.NComparison): |
|
511 """< - Less than """ |
|
512 class _3d_(aetools.NComparison): |
|
513 """= - Equal """ |
|
514 class _3e_(aetools.NComparison): |
|
515 """> - Greater than """ |
|
516 class contains(aetools.NComparison): |
|
517 """contains - Contains """ |
|
518 class ends_with(aetools.NComparison): |
|
519 """ends with - Ends with """ |
|
520 class starts_with(aetools.NComparison): |
|
521 """starts with - Starts with """ |
|
522 class _b2_(aetools.NComparison): |
|
523 """\xb2 - Less than or equal to """ |
|
524 class _b3_(aetools.NComparison): |
|
525 """\xb3 - Greater than or equal to """ |
|
526 _Enum_savo = { |
|
527 'ask' : 'ask ', # Ask the user whether or not to save the file. |
|
528 'yes' : 'yes ', # Save the file. |
|
529 'no' : 'no ', # Do not save the file. |
|
530 } |
|
531 |
|
532 |
|
533 # |
|
534 # Indices of types declared in this module |
|
535 # |
|
536 _classdeclarations = { |
|
537 'capp' : application, |
|
538 'cobj' : item, |
|
539 'colr' : color, |
|
540 'cwin' : window, |
|
541 'docu' : document, |
|
542 } |
|
543 |
|
544 _propdeclarations = { |
|
545 'ID ' : _Prop_id, |
|
546 'c@#^' : _Prop__3c_Inheritance_3e_, |
|
547 'docu' : _Prop_document, |
|
548 'hclb' : _Prop_closeable, |
|
549 'imod' : _Prop_modified, |
|
550 'isfl' : _Prop_floating, |
|
551 'ismn' : _Prop_miniaturizable, |
|
552 'iszm' : _Prop_zoomable, |
|
553 'pALL' : _Prop_properties, |
|
554 'pbnd' : _Prop_bounds, |
|
555 'pcls' : _Prop_class_, |
|
556 'pidx' : _Prop_index, |
|
557 'pisf' : _Prop_frontmost, |
|
558 'pmnd' : _Prop_miniaturized, |
|
559 'pmod' : _Prop_modal, |
|
560 'pnam' : _Prop_name, |
|
561 'ppth' : _Prop_path, |
|
562 'prsz' : _Prop_resizable, |
|
563 'ptit' : _Prop_titled, |
|
564 'pvis' : _Prop_visible, |
|
565 'pzum' : _Prop_zoomed, |
|
566 'vers' : _Prop_version, |
|
567 } |
|
568 |
|
569 _compdeclarations = { |
|
570 '< ' : _3c_, |
|
571 '<= ' : _b2_, |
|
572 '= ' : _3d_, |
|
573 '> ' : _3e_, |
|
574 '>= ' : _b3_, |
|
575 'bgwt' : starts_with, |
|
576 'cont' : contains, |
|
577 'ends' : ends_with, |
|
578 } |
|
579 |
|
580 _enumdeclarations = { |
|
581 'savo' : _Enum_savo, |
|
582 } |