py-cvs-rel2_1 (Rev 1.2) merge
[python/dscho.git] / Mac / Lib / lib-scriptpackages / StdSuites / Standard_Suite.py
blob7870acda5c8f61d5f243ec1cf36bf7e85c0b1aa6
1 """Suite Standard Suite: Common terms for most applications
2 Level 1, version 1
4 Generated from Macintosh HD:Systeemmap:Extensies:AppleScript
5 AETE/AEUT resource version 1/0, language 0, script 0
6 """
8 import aetools
9 import MacOS
11 _code = 'core'
13 class Standard_Suite_Events:
15 def open(self, _object, _attributes={}, **_arguments):
16 """open: Open the specified object(s)
17 Required argument: list of objects to open
18 Keyword argument _attributes: AppleEvent attribute dictionary
19 """
20 _code = 'aevt'
21 _subcode = 'odoc'
23 if _arguments: raise TypeError, 'No optional args expected'
24 _arguments['----'] = _object
27 _reply, _arguments, _attributes = self.send(_code, _subcode,
28 _arguments, _attributes)
29 if _arguments.has_key('errn'):
30 raise aetools.Error, aetools.decodeerror(_arguments)
31 # XXXX Optionally decode result
32 if _arguments.has_key('----'):
33 return _arguments['----']
35 def run(self, _no_object=None, _attributes={}, **_arguments):
36 """run: Run an application. Most applications will open an empty, untitled window.
37 Keyword argument _attributes: AppleEvent attribute dictionary
38 """
39 _code = 'aevt'
40 _subcode = 'oapp'
42 if _arguments: raise TypeError, 'No optional args expected'
43 if _no_object != None: raise TypeError, 'No direct arg expected'
46 _reply, _arguments, _attributes = self.send(_code, _subcode,
47 _arguments, _attributes)
48 if _arguments.has_key('errn'):
49 raise aetools.Error, aetools.decodeerror(_arguments)
50 # XXXX Optionally decode result
51 if _arguments.has_key('----'):
52 return _arguments['----']
54 def reopen(self, _no_object=None, _attributes={}, **_arguments):
55 """reopen: Reactivate a running application. Some applications will open a new untitled window if no window is open.
56 Keyword argument _attributes: AppleEvent attribute dictionary
57 """
58 _code = 'aevt'
59 _subcode = 'rapp'
61 if _arguments: raise TypeError, 'No optional args expected'
62 if _no_object != None: raise TypeError, 'No direct arg expected'
65 _reply, _arguments, _attributes = self.send(_code, _subcode,
66 _arguments, _attributes)
67 if _arguments.has_key('errn'):
68 raise aetools.Error, aetools.decodeerror(_arguments)
69 # XXXX Optionally decode result
70 if _arguments.has_key('----'):
71 return _arguments['----']
73 def _print(self, _object, _attributes={}, **_arguments):
74 """print: Print the specified object(s)
75 Required argument: list of objects to print
76 Keyword argument _attributes: AppleEvent attribute dictionary
77 """
78 _code = 'aevt'
79 _subcode = 'pdoc'
81 if _arguments: raise TypeError, 'No optional args expected'
82 _arguments['----'] = _object
85 _reply, _arguments, _attributes = self.send(_code, _subcode,
86 _arguments, _attributes)
87 if _arguments.has_key('errn'):
88 raise aetools.Error, aetools.decodeerror(_arguments)
89 # XXXX Optionally decode result
90 if _arguments.has_key('----'):
91 return _arguments['----']
93 _argmap_quit = {
94 'saving' : 'savo',
97 def quit(self, _no_object=None, _attributes={}, **_arguments):
98 """quit: Quit an application
99 Keyword argument saving: specifies whether to save currently open documents
100 Keyword argument _attributes: AppleEvent attribute dictionary
102 _code = 'aevt'
103 _subcode = 'quit'
105 aetools.keysubst(_arguments, self._argmap_quit)
106 if _no_object != None: raise TypeError, 'No direct arg expected'
108 aetools.enumsubst(_arguments, 'savo', _Enum_savo)
110 _reply, _arguments, _attributes = self.send(_code, _subcode,
111 _arguments, _attributes)
112 if _arguments.has_key('errn'):
113 raise aetools.Error, aetools.decodeerror(_arguments)
114 # XXXX Optionally decode result
115 if _arguments.has_key('----'):
116 return _arguments['----']
118 _argmap_close = {
119 'saving' : 'savo',
120 'saving_in' : 'kfil',
123 def close(self, _object, _attributes={}, **_arguments):
124 """close: Close an object
125 Required argument: the object to close
126 Keyword argument saving: specifies whether changes should be saved before closing
127 Keyword argument saving_in: the file in which to save the object
128 Keyword argument _attributes: AppleEvent attribute dictionary
130 _code = 'core'
131 _subcode = 'clos'
133 aetools.keysubst(_arguments, self._argmap_close)
134 _arguments['----'] = _object
136 aetools.enumsubst(_arguments, 'savo', _Enum_savo)
138 _reply, _arguments, _attributes = self.send(_code, _subcode,
139 _arguments, _attributes)
140 if _arguments.has_key('errn'):
141 raise aetools.Error, aetools.decodeerror(_arguments)
142 # XXXX Optionally decode result
143 if _arguments.has_key('----'):
144 return _arguments['----']
146 _argmap_count = {
147 'each' : 'kocl',
150 def count(self, _object, _attributes={}, **_arguments):
151 """count: Return the number of elements of an object
152 Required argument: the object whose elements are to be counted
153 Keyword argument each: if specified, restricts counting to objects of this class
154 Keyword argument _attributes: AppleEvent attribute dictionary
155 Returns: the number of elements
157 _code = 'core'
158 _subcode = 'cnte'
160 aetools.keysubst(_arguments, self._argmap_count)
161 _arguments['----'] = _object
164 _reply, _arguments, _attributes = self.send(_code, _subcode,
165 _arguments, _attributes)
166 if _arguments.has_key('errn'):
167 raise aetools.Error, aetools.decodeerror(_arguments)
168 # XXXX Optionally decode result
169 if _arguments.has_key('----'):
170 return _arguments['----']
172 def delete(self, _object, _attributes={}, **_arguments):
173 """delete: Delete an object from its container. Note this does not work on script variables, only on elements of application classes.
174 Required argument: the element to delete
175 Keyword argument _attributes: AppleEvent attribute dictionary
177 _code = 'core'
178 _subcode = 'delo'
180 if _arguments: raise TypeError, 'No optional args expected'
181 _arguments['----'] = _object
184 _reply, _arguments, _attributes = self.send(_code, _subcode,
185 _arguments, _attributes)
186 if _arguments.has_key('errn'):
187 raise aetools.Error, aetools.decodeerror(_arguments)
188 # XXXX Optionally decode result
189 if _arguments.has_key('----'):
190 return _arguments['----']
192 _argmap_duplicate = {
193 'to' : 'insh',
194 'with_properties' : 'prdt',
197 def duplicate(self, _object, _attributes={}, **_arguments):
198 """duplicate: Duplicate one or more objects
199 Required argument: the object(s) to duplicate
200 Keyword argument to: the new location for the object(s)
201 Keyword argument with_properties: the initial values for properties of the new object that are to be different from the original
202 Keyword argument _attributes: AppleEvent attribute dictionary
203 Returns: to the duplicated object(s)
205 _code = 'core'
206 _subcode = 'clon'
208 aetools.keysubst(_arguments, self._argmap_duplicate)
209 _arguments['----'] = _object
212 _reply, _arguments, _attributes = self.send(_code, _subcode,
213 _arguments, _attributes)
214 if _arguments.has_key('errn'):
215 raise aetools.Error, aetools.decodeerror(_arguments)
216 # XXXX Optionally decode result
217 if _arguments.has_key('----'):
218 return _arguments['----']
220 def exists(self, _object, _attributes={}, **_arguments):
221 """exists: Verify if an object exists
222 Required argument: the object in question
223 Keyword argument _attributes: AppleEvent attribute dictionary
224 Returns: true if it exists, false if not
226 _code = 'core'
227 _subcode = 'doex'
229 if _arguments: raise TypeError, 'No optional args expected'
230 _arguments['----'] = _object
233 _reply, _arguments, _attributes = self.send(_code, _subcode,
234 _arguments, _attributes)
235 if _arguments.has_key('errn'):
236 raise aetools.Error, aetools.decodeerror(_arguments)
237 # XXXX Optionally decode result
238 if _arguments.has_key('----'):
239 return _arguments['----']
241 _argmap_make = {
242 'new' : 'kocl',
243 'at' : 'insh',
244 'with_data' : 'data',
245 'with_properties' : 'prdt',
248 def make(self, _no_object=None, _attributes={}, **_arguments):
249 """make: Make a new element
250 Keyword argument new: the class of the new element
251 Keyword argument at: the location at which to insert the element
252 Keyword argument with_data: the initial data for the element
253 Keyword argument with_properties: the initial values for the properties of the element
254 Keyword argument _attributes: AppleEvent attribute dictionary
255 Returns: to the new object(s)
257 _code = 'core'
258 _subcode = 'crel'
260 aetools.keysubst(_arguments, self._argmap_make)
261 if _no_object != None: raise TypeError, 'No direct arg expected'
264 _reply, _arguments, _attributes = self.send(_code, _subcode,
265 _arguments, _attributes)
266 if _arguments.has_key('errn'):
267 raise aetools.Error, aetools.decodeerror(_arguments)
268 # XXXX Optionally decode result
269 if _arguments.has_key('----'):
270 return _arguments['----']
272 _argmap_move = {
273 'to' : 'insh',
276 def move(self, _object, _attributes={}, **_arguments):
277 """move: Move object(s) to a new location
278 Required argument: the object(s) to move
279 Keyword argument to: the new location for the object(s)
280 Keyword argument _attributes: AppleEvent attribute dictionary
281 Returns: to the object(s) after they have been moved
283 _code = 'core'
284 _subcode = 'move'
286 aetools.keysubst(_arguments, self._argmap_move)
287 _arguments['----'] = _object
290 _reply, _arguments, _attributes = self.send(_code, _subcode,
291 _arguments, _attributes)
292 if _arguments.has_key('errn'):
293 raise aetools.Error, aetools.decodeerror(_arguments)
294 # XXXX Optionally decode result
295 if _arguments.has_key('----'):
296 return _arguments['----']
298 _argmap_save = {
299 '_in' : 'kfil',
300 'as' : 'fltp',
303 def save(self, _object, _attributes={}, **_arguments):
304 """save: Save an object
305 Required argument: the object to save, usually a document or window
306 Keyword argument _in: the file in which to save the object
307 Keyword argument as: the file type of the document in which to save the data
308 Keyword argument _attributes: AppleEvent attribute dictionary
310 _code = 'core'
311 _subcode = 'save'
313 aetools.keysubst(_arguments, self._argmap_save)
314 _arguments['----'] = _object
317 _reply, _arguments, _attributes = self.send(_code, _subcode,
318 _arguments, _attributes)
319 if _arguments.has_key('errn'):
320 raise aetools.Error, aetools.decodeerror(_arguments)
321 # XXXX Optionally decode result
322 if _arguments.has_key('----'):
323 return _arguments['----']
325 def select(self, _object, _attributes={}, **_arguments):
326 """select: Make a selection
327 Required argument: the object to select
328 Keyword argument _attributes: AppleEvent attribute dictionary
330 _code = 'misc'
331 _subcode = 'slct'
333 if _arguments: raise TypeError, 'No optional args expected'
334 _arguments['----'] = _object
337 _reply, _arguments, _attributes = self.send(_code, _subcode,
338 _arguments, _attributes)
339 if _arguments.has_key('errn'):
340 raise aetools.Error, aetools.decodeerror(_arguments)
341 # XXXX Optionally decode result
342 if _arguments.has_key('----'):
343 return _arguments['----']
345 _argmap_data_size = {
346 'as' : 'rtyp',
349 def data_size(self, _object, _attributes={}, **_arguments):
350 """data size: (optional) Return the size in bytes of an object
351 Required argument: the object whose data size is to be returned
352 Keyword argument as: the data type for which the size is calculated
353 Keyword argument _attributes: AppleEvent attribute dictionary
354 Returns: the size of the object in bytes
356 _code = 'core'
357 _subcode = 'dsiz'
359 aetools.keysubst(_arguments, self._argmap_data_size)
360 _arguments['----'] = _object
363 _reply, _arguments, _attributes = self.send(_code, _subcode,
364 _arguments, _attributes)
365 if _arguments.has_key('errn'):
366 raise aetools.Error, aetools.decodeerror(_arguments)
367 # XXXX Optionally decode result
368 if _arguments.has_key('----'):
369 return _arguments['----']
371 _argmap_suite_info = {
372 '_in' : 'wrcd',
375 def suite_info(self, _object, _attributes={}, **_arguments):
376 """suite info: (optional) Get information about event suite(s)
377 Required argument: the suite for which to return information
378 Keyword argument _in: the human language and script system in which to return information
379 Keyword argument _attributes: AppleEvent attribute dictionary
380 Returns: a record containing the suites and their versions
382 _code = 'core'
383 _subcode = 'gtsi'
385 aetools.keysubst(_arguments, self._argmap_suite_info)
386 _arguments['----'] = _object
389 _reply, _arguments, _attributes = self.send(_code, _subcode,
390 _arguments, _attributes)
391 if _arguments.has_key('errn'):
392 raise aetools.Error, aetools.decodeerror(_arguments)
393 # XXXX Optionally decode result
394 if _arguments.has_key('----'):
395 return _arguments['----']
397 _argmap_event_info = {
398 '_in' : 'wrcd',
401 def event_info(self, _object, _attributes={}, **_arguments):
402 """event info: (optional) Get information about the Apple events in a suite
403 Required argument: the event class of the Apple events for which to return information
404 Keyword argument _in: the human language and script system in which to return information
405 Keyword argument _attributes: AppleEvent attribute dictionary
406 Returns: a record containing the events and their parameters
408 _code = 'core'
409 _subcode = 'gtei'
411 aetools.keysubst(_arguments, self._argmap_event_info)
412 _arguments['----'] = _object
415 _reply, _arguments, _attributes = self.send(_code, _subcode,
416 _arguments, _attributes)
417 if _arguments.has_key('errn'):
418 raise aetools.Error, aetools.decodeerror(_arguments)
419 # XXXX Optionally decode result
420 if _arguments.has_key('----'):
421 return _arguments['----']
423 _argmap_class_info = {
424 '_in' : 'wrcd',
427 def class_info(self, _object=None, _attributes={}, **_arguments):
428 """class info: (optional) Get information about an object class
429 Required argument: the object class about which information is requested
430 Keyword argument _in: the human language and script system in which to return information
431 Keyword argument _attributes: AppleEvent attribute dictionary
432 Returns: a record containing the objectÕs properties and elements
434 _code = 'core'
435 _subcode = 'qobj'
437 aetools.keysubst(_arguments, self._argmap_class_info)
438 _arguments['----'] = _object
441 _reply, _arguments, _attributes = self.send(_code, _subcode,
442 _arguments, _attributes)
443 if _arguments.has_key('errn'):
444 raise aetools.Error, aetools.decodeerror(_arguments)
445 # XXXX Optionally decode result
446 if _arguments.has_key('----'):
447 return _arguments['----']
450 class application(aetools.ComponentItem):
451 """application - An application program """
452 want = 'capp'
453 class name(aetools.NProperty):
454 """name - the name of the application """
455 which = 'pnam'
456 want = 'itxt'
457 class frontmost(aetools.NProperty):
458 """frontmost - Is this the frontmost application? """
459 which = 'pisf'
460 want = 'bool'
461 class selection(aetools.NProperty):
462 """selection - the selection visible to the user. Use the •selectÕ command to set a new selection; use •contents of selectionÕ to get or change information in the document. """
463 which = 'sele'
464 want = 'csel'
465 class clipboard(aetools.NProperty):
466 """clipboard - the contents of the clipboard for this application """
467 which = 'pcli'
468 want = '****'
469 class version(aetools.NProperty):
470 """version - the version of the application """
471 which = 'vers'
472 want = 'vers'
474 applications = application
476 class document(aetools.ComponentItem):
477 """document - A document of a scriptable application """
478 want = 'docu'
479 class modified(aetools.NProperty):
480 """modified - Has the document been modified since the last save? """
481 which = 'imod'
482 want = 'bool'
484 documents = document
486 class file(aetools.ComponentItem):
487 """file - a file on a disk or server (or a file yet to be created) """
488 want = 'file'
489 class stationery(aetools.NProperty):
490 """stationery - Is the file a stationery file? """
491 which = 'pspd'
492 want = 'bool'
494 files = file
496 class alias(aetools.ComponentItem):
497 """alias - a file on a disk or server. The file must exist when you check the syntax of your script. """
498 want = 'alis'
500 aliases = alias
502 class selection_2d_object(aetools.ComponentItem):
503 """selection-object - A way to refer to the state of the current of the selection. Use the •selectÕ command to make a new selection. """
504 want = 'csel'
505 class contents(aetools.NProperty):
506 """contents - the information currently selected. Use •contents of selectionÕ to get or change information in a document. """
507 which = 'pcnt'
508 want = '****'
510 class window(aetools.ComponentItem):
511 """window - A window """
512 want = 'cwin'
513 class bounds(aetools.NProperty):
514 """bounds - the boundary rectangle for the window """
515 which = 'pbnd'
516 want = 'qdrt'
517 class closeable(aetools.NProperty):
518 """closeable - Does the window have a close box? """
519 which = 'hclb'
520 want = 'bool'
521 class titled(aetools.NProperty):
522 """titled - Does the window have a title bar? """
523 which = 'ptit'
524 want = 'bool'
525 class index(aetools.NProperty):
526 """index - the number of the window """
527 which = 'pidx'
528 want = 'long'
529 class floating(aetools.NProperty):
530 """floating - Does the window float? """
531 which = 'isfl'
532 want = 'bool'
533 class modal(aetools.NProperty):
534 """modal - Is the window modal? """
535 which = 'pmod'
536 want = 'bool'
537 class resizable(aetools.NProperty):
538 """resizable - Is the window resizable? """
539 which = 'prsz'
540 want = 'bool'
541 class zoomable(aetools.NProperty):
542 """zoomable - Is the window zoomable? """
543 which = 'iszm'
544 want = 'bool'
545 class zoomed(aetools.NProperty):
546 """zoomed - Is the window zoomed? """
547 which = 'pzum'
548 want = 'bool'
549 class visible(aetools.NProperty):
550 """visible - Is the window visible? """
551 which = 'pvis'
552 want = 'bool'
554 windows = window
556 class insertion_point(aetools.ComponentItem):
557 """insertion point - An insertion location between two objects """
558 want = 'cins'
560 insertion_points = insertion_point
561 application._propdict = {
562 'name' : name,
563 'frontmost' : frontmost,
564 'selection' : selection,
565 'clipboard' : clipboard,
566 'version' : version,
568 application._elemdict = {
570 document._propdict = {
571 'modified' : modified,
573 document._elemdict = {
575 file._propdict = {
576 'stationery' : stationery,
578 file._elemdict = {
580 alias._propdict = {
582 alias._elemdict = {
584 selection_2d_object._propdict = {
585 'contents' : contents,
587 selection_2d_object._elemdict = {
589 window._propdict = {
590 'bounds' : bounds,
591 'closeable' : closeable,
592 'titled' : titled,
593 'index' : index,
594 'floating' : floating,
595 'modal' : modal,
596 'resizable' : resizable,
597 'zoomable' : zoomable,
598 'zoomed' : zoomed,
599 'visible' : visible,
601 window._elemdict = {
603 insertion_point._propdict = {
605 insertion_point._elemdict = {
607 class starts_with(aetools.NComparison):
608 """starts with - Starts with """
609 class contains(aetools.NComparison):
610 """contains - Contains """
611 class ends_with(aetools.NComparison):
612 """ends with - Ends with """
613 class _3d_(aetools.NComparison):
614 """= - Equal """
615 class _3e_(aetools.NComparison):
616 """> - Greater than """
617 class _b3_(aetools.NComparison):
618 """³ - Greater than or equal to """
619 class _3c_(aetools.NComparison):
620 """< - Less than """
621 class _b2_(aetools.NComparison):
622 """² - Less than or equal to """
623 _Enum_savo = {
624 'yes' : 'yes ', # Save objects now
625 'no' : 'no ', # Do not save objects
626 'ask' : 'ask ', # Ask the user whether to save
629 _Enum_kfrm = {
630 'index' : 'indx', # keyform designating indexed access
631 'named' : 'name', # keyform designating named access
632 'id' : 'ID ', # keyform designating access by unique identifier
635 _Enum_styl = {
636 'plain' : 'plan', # Plain
637 'bold' : 'bold', # Bold
638 'italic' : 'ital', # Italic
639 'outline' : 'outl', # Outline
640 'shadow' : 'shad', # Shadow
641 'underline' : 'undl', # Underline
642 'superscript' : 'spsc', # Superscript
643 'subscript' : 'sbsc', # Subscript
644 'strikethrough' : 'strk', # Strikethrough
645 'small_caps' : 'smcp', # Small caps
646 'all_caps' : 'alcp', # All capital letters
647 'all_lowercase' : 'lowc', # Lowercase
648 'condensed' : 'cond', # Condensed
649 'expanded' : 'pexp', # Expanded
650 'hidden' : 'hidn', # Hidden
655 # Indices of types declared in this module
657 _classdeclarations = {
658 'docu' : document,
659 'cins' : insertion_point,
660 'capp' : application,
661 'alis' : alias,
662 'csel' : selection_2d_object,
663 'file' : file,
664 'cwin' : window,
667 _propdeclarations = {
668 'ptit' : titled,
669 'pidx' : index,
670 'pnam' : name,
671 'pzum' : zoomed,
672 'pcnt' : contents,
673 'pcli' : clipboard,
674 'hclb' : closeable,
675 'iszm' : zoomable,
676 'isfl' : floating,
677 'pspd' : stationery,
678 'pisf' : frontmost,
679 'sele' : selection,
680 'pbnd' : bounds,
681 'imod' : modified,
682 'pvis' : visible,
683 'pmod' : modal,
684 'vers' : version,
685 'prsz' : resizable,
688 _compdeclarations = {
689 '> ' : _3e_,
690 'bgwt' : starts_with,
691 '>= ' : _b3_,
692 '= ' : _3d_,
693 '<= ' : _b2_,
694 'cont' : contains,
695 'ends' : ends_with,
696 '< ' : _3c_,
699 _enumdeclarations = {
700 'styl' : _Enum_styl,
701 'savo' : _Enum_savo,
702 'kfrm' : _Enum_kfrm,