append(): Fixing the test for convertability after consultation with
[python/dscho.git] / Mac / Lib / lib-scriptpackages / StdSuites / Standard_Suite.py
blob444a0f0a74c28fcf897d31e2640db85625845239
1 """Suite Standard Suite: Common terms for most applications
2 Level 1, version 1
4 Generated from /Volumes/Sap/System Folder/Extensions/AppleScript
5 AETE/AEUT resource version 1/0, language 0, script 0
6 """
8 import aetools
9 import MacOS
11 _code = 'core'
13 from _builtinSuites.builtin_Suite import *
14 class Standard_Suite_Events(builtin_Suite_Events):
16 def open(self, _object, _attributes={}, **_arguments):
17 """open: Open the specified object(s)
18 Required argument: list of objects to open
19 Keyword argument _attributes: AppleEvent attribute dictionary
20 """
21 _code = 'aevt'
22 _subcode = 'odoc'
24 if _arguments: raise TypeError, 'No optional args expected'
25 _arguments['----'] = _object
28 _reply, _arguments, _attributes = self.send(_code, _subcode,
29 _arguments, _attributes)
30 if _arguments.get('errn', 0):
31 raise aetools.Error, aetools.decodeerror(_arguments)
32 # XXXX Optionally decode result
33 if _arguments.has_key('----'):
34 return _arguments['----']
36 def run(self, _no_object=None, _attributes={}, **_arguments):
37 """run: Run an application. Most applications will open an empty, untitled window.
38 Keyword argument _attributes: AppleEvent attribute dictionary
39 """
40 _code = 'aevt'
41 _subcode = 'oapp'
43 if _arguments: raise TypeError, 'No optional args expected'
44 if _no_object != None: raise TypeError, 'No direct arg expected'
47 _reply, _arguments, _attributes = self.send(_code, _subcode,
48 _arguments, _attributes)
49 if _arguments.get('errn', 0):
50 raise aetools.Error, aetools.decodeerror(_arguments)
51 # XXXX Optionally decode result
52 if _arguments.has_key('----'):
53 return _arguments['----']
55 def reopen(self, _no_object=None, _attributes={}, **_arguments):
56 """reopen: Reactivate a running application. Some applications will open a new untitled window if no window is open.
57 Keyword argument _attributes: AppleEvent attribute dictionary
58 """
59 _code = 'aevt'
60 _subcode = 'rapp'
62 if _arguments: raise TypeError, 'No optional args expected'
63 if _no_object != None: raise TypeError, 'No direct arg expected'
66 _reply, _arguments, _attributes = self.send(_code, _subcode,
67 _arguments, _attributes)
68 if _arguments.get('errn', 0):
69 raise aetools.Error, aetools.decodeerror(_arguments)
70 # XXXX Optionally decode result
71 if _arguments.has_key('----'):
72 return _arguments['----']
74 def print_(self, _object, _attributes={}, **_arguments):
75 """print: Print the specified object(s)
76 Required argument: list of objects to print
77 Keyword argument _attributes: AppleEvent attribute dictionary
78 """
79 _code = 'aevt'
80 _subcode = 'pdoc'
82 if _arguments: raise TypeError, 'No optional args expected'
83 _arguments['----'] = _object
86 _reply, _arguments, _attributes = self.send(_code, _subcode,
87 _arguments, _attributes)
88 if _arguments.get('errn', 0):
89 raise aetools.Error, aetools.decodeerror(_arguments)
90 # XXXX Optionally decode result
91 if _arguments.has_key('----'):
92 return _arguments['----']
94 _argmap_quit = {
95 'saving' : 'savo',
98 def quit(self, _no_object=None, _attributes={}, **_arguments):
99 """quit: Quit an application
100 Keyword argument saving: specifies whether to save currently open documents
101 Keyword argument _attributes: AppleEvent attribute dictionary
103 _code = 'aevt'
104 _subcode = 'quit'
106 aetools.keysubst(_arguments, self._argmap_quit)
107 if _no_object != None: raise TypeError, 'No direct arg expected'
109 aetools.enumsubst(_arguments, 'savo', _Enum_savo)
111 _reply, _arguments, _attributes = self.send(_code, _subcode,
112 _arguments, _attributes)
113 if _arguments.get('errn', 0):
114 raise aetools.Error, aetools.decodeerror(_arguments)
115 # XXXX Optionally decode result
116 if _arguments.has_key('----'):
117 return _arguments['----']
119 _argmap_close = {
120 'saving' : 'savo',
121 'saving_in' : 'kfil',
124 def close(self, _object, _attributes={}, **_arguments):
125 """close: Close an object
126 Required argument: the object to close
127 Keyword argument saving: specifies whether changes should be saved before closing
128 Keyword argument saving_in: the file in which to save the object
129 Keyword argument _attributes: AppleEvent attribute dictionary
131 _code = 'core'
132 _subcode = 'clos'
134 aetools.keysubst(_arguments, self._argmap_close)
135 _arguments['----'] = _object
137 aetools.enumsubst(_arguments, 'savo', _Enum_savo)
139 _reply, _arguments, _attributes = self.send(_code, _subcode,
140 _arguments, _attributes)
141 if _arguments.get('errn', 0):
142 raise aetools.Error, aetools.decodeerror(_arguments)
143 # XXXX Optionally decode result
144 if _arguments.has_key('----'):
145 return _arguments['----']
147 _argmap_count = {
148 'each' : 'kocl',
151 def count(self, _object, _attributes={}, **_arguments):
152 """count: Return the number of elements of an object
153 Required argument: the object whose elements are to be counted
154 Keyword argument each: if specified, restricts counting to objects of this class
155 Keyword argument _attributes: AppleEvent attribute dictionary
156 Returns: the number of elements
158 _code = 'core'
159 _subcode = 'cnte'
161 aetools.keysubst(_arguments, self._argmap_count)
162 _arguments['----'] = _object
165 _reply, _arguments, _attributes = self.send(_code, _subcode,
166 _arguments, _attributes)
167 if _arguments.get('errn', 0):
168 raise aetools.Error, aetools.decodeerror(_arguments)
169 # XXXX Optionally decode result
170 if _arguments.has_key('----'):
171 return _arguments['----']
173 def delete(self, _object, _attributes={}, **_arguments):
174 """delete: Delete an object from its container. Note this does not work on script variables, only on elements of application classes.
175 Required argument: the element to delete
176 Keyword argument _attributes: AppleEvent attribute dictionary
178 _code = 'core'
179 _subcode = 'delo'
181 if _arguments: raise TypeError, 'No optional args expected'
182 _arguments['----'] = _object
185 _reply, _arguments, _attributes = self.send(_code, _subcode,
186 _arguments, _attributes)
187 if _arguments.get('errn', 0):
188 raise aetools.Error, aetools.decodeerror(_arguments)
189 # XXXX Optionally decode result
190 if _arguments.has_key('----'):
191 return _arguments['----']
193 _argmap_duplicate = {
194 'to' : 'insh',
195 'with_properties' : 'prdt',
198 def duplicate(self, _object, _attributes={}, **_arguments):
199 """duplicate: Duplicate one or more objects
200 Required argument: the object(s) to duplicate
201 Keyword argument to: the new location for the object(s)
202 Keyword argument with_properties: the initial values for properties of the new object that are to be different from the original
203 Keyword argument _attributes: AppleEvent attribute dictionary
204 Returns: to the duplicated object(s)
206 _code = 'core'
207 _subcode = 'clon'
209 aetools.keysubst(_arguments, self._argmap_duplicate)
210 _arguments['----'] = _object
213 _reply, _arguments, _attributes = self.send(_code, _subcode,
214 _arguments, _attributes)
215 if _arguments.get('errn', 0):
216 raise aetools.Error, aetools.decodeerror(_arguments)
217 # XXXX Optionally decode result
218 if _arguments.has_key('----'):
219 return _arguments['----']
221 def exists(self, _object, _attributes={}, **_arguments):
222 """exists: Verify if an object exists
223 Required argument: the object in question
224 Keyword argument _attributes: AppleEvent attribute dictionary
225 Returns: true if it exists, false if not
227 _code = 'core'
228 _subcode = 'doex'
230 if _arguments: raise TypeError, 'No optional args expected'
231 _arguments['----'] = _object
234 _reply, _arguments, _attributes = self.send(_code, _subcode,
235 _arguments, _attributes)
236 if _arguments.get('errn', 0):
237 raise aetools.Error, aetools.decodeerror(_arguments)
238 # XXXX Optionally decode result
239 if _arguments.has_key('----'):
240 return _arguments['----']
242 _argmap_make = {
243 'new' : 'kocl',
244 'at' : 'insh',
245 'with_data' : 'data',
246 'with_properties' : 'prdt',
249 def make(self, _no_object=None, _attributes={}, **_arguments):
250 """make: Make a new element
251 Keyword argument new: the class of the new element
252 Keyword argument at: the location at which to insert the element
253 Keyword argument with_data: the initial data for the element
254 Keyword argument with_properties: the initial values for the properties of the element
255 Keyword argument _attributes: AppleEvent attribute dictionary
256 Returns: to the new object(s)
258 _code = 'core'
259 _subcode = 'crel'
261 aetools.keysubst(_arguments, self._argmap_make)
262 if _no_object != None: raise TypeError, 'No direct arg expected'
265 _reply, _arguments, _attributes = self.send(_code, _subcode,
266 _arguments, _attributes)
267 if _arguments.get('errn', 0):
268 raise aetools.Error, aetools.decodeerror(_arguments)
269 # XXXX Optionally decode result
270 if _arguments.has_key('----'):
271 return _arguments['----']
273 _argmap_move = {
274 'to' : 'insh',
277 def move(self, _object, _attributes={}, **_arguments):
278 """move: Move object(s) to a new location
279 Required argument: the object(s) to move
280 Keyword argument to: the new location for the object(s)
281 Keyword argument _attributes: AppleEvent attribute dictionary
282 Returns: to the object(s) after they have been moved
284 _code = 'core'
285 _subcode = 'move'
287 aetools.keysubst(_arguments, self._argmap_move)
288 _arguments['----'] = _object
291 _reply, _arguments, _attributes = self.send(_code, _subcode,
292 _arguments, _attributes)
293 if _arguments.get('errn', 0):
294 raise aetools.Error, aetools.decodeerror(_arguments)
295 # XXXX Optionally decode result
296 if _arguments.has_key('----'):
297 return _arguments['----']
299 _argmap_save = {
300 'in_' : 'kfil',
301 'as' : 'fltp',
304 def save(self, _object, _attributes={}, **_arguments):
305 """save: Save an object
306 Required argument: the object to save, usually a document or window
307 Keyword argument in_: the file in which to save the object
308 Keyword argument as: the file type of the document in which to save the data
309 Keyword argument _attributes: AppleEvent attribute dictionary
311 _code = 'core'
312 _subcode = 'save'
314 aetools.keysubst(_arguments, self._argmap_save)
315 _arguments['----'] = _object
318 _reply, _arguments, _attributes = self.send(_code, _subcode,
319 _arguments, _attributes)
320 if _arguments.get('errn', 0):
321 raise aetools.Error, aetools.decodeerror(_arguments)
322 # XXXX Optionally decode result
323 if _arguments.has_key('----'):
324 return _arguments['----']
326 def select(self, _object, _attributes={}, **_arguments):
327 """select: Make a selection
328 Required argument: the object to select
329 Keyword argument _attributes: AppleEvent attribute dictionary
331 _code = 'misc'
332 _subcode = 'slct'
334 if _arguments: raise TypeError, 'No optional args expected'
335 _arguments['----'] = _object
338 _reply, _arguments, _attributes = self.send(_code, _subcode,
339 _arguments, _attributes)
340 if _arguments.get('errn', 0):
341 raise aetools.Error, aetools.decodeerror(_arguments)
342 # XXXX Optionally decode result
343 if _arguments.has_key('----'):
344 return _arguments['----']
346 _argmap_data_size = {
347 'as' : 'rtyp',
350 def data_size(self, _object, _attributes={}, **_arguments):
351 """data size: (optional) Return the size in bytes of an object
352 Required argument: the object whose data size is to be returned
353 Keyword argument as: the data type for which the size is calculated
354 Keyword argument _attributes: AppleEvent attribute dictionary
355 Returns: the size of the object in bytes
357 _code = 'core'
358 _subcode = 'dsiz'
360 aetools.keysubst(_arguments, self._argmap_data_size)
361 _arguments['----'] = _object
364 _reply, _arguments, _attributes = self.send(_code, _subcode,
365 _arguments, _attributes)
366 if _arguments.get('errn', 0):
367 raise aetools.Error, aetools.decodeerror(_arguments)
368 # XXXX Optionally decode result
369 if _arguments.has_key('----'):
370 return _arguments['----']
372 _argmap_suite_info = {
373 'in_' : 'wrcd',
376 def suite_info(self, _object, _attributes={}, **_arguments):
377 """suite info: (optional) Get information about event suite(s)
378 Required argument: the suite for which to return information
379 Keyword argument in_: the human language and script system in which to return information
380 Keyword argument _attributes: AppleEvent attribute dictionary
381 Returns: a record containing the suites and their versions
383 _code = 'core'
384 _subcode = 'gtsi'
386 aetools.keysubst(_arguments, self._argmap_suite_info)
387 _arguments['----'] = _object
390 _reply, _arguments, _attributes = self.send(_code, _subcode,
391 _arguments, _attributes)
392 if _arguments.get('errn', 0):
393 raise aetools.Error, aetools.decodeerror(_arguments)
394 # XXXX Optionally decode result
395 if _arguments.has_key('----'):
396 return _arguments['----']
398 _argmap_event_info = {
399 'in_' : 'wrcd',
402 def event_info(self, _object, _attributes={}, **_arguments):
403 """event info: (optional) Get information about the Apple events in a suite
404 Required argument: the event class of the Apple events for which to return information
405 Keyword argument in_: the human language and script system in which to return information
406 Keyword argument _attributes: AppleEvent attribute dictionary
407 Returns: a record containing the events and their parameters
409 _code = 'core'
410 _subcode = 'gtei'
412 aetools.keysubst(_arguments, self._argmap_event_info)
413 _arguments['----'] = _object
416 _reply, _arguments, _attributes = self.send(_code, _subcode,
417 _arguments, _attributes)
418 if _arguments.get('errn', 0):
419 raise aetools.Error, aetools.decodeerror(_arguments)
420 # XXXX Optionally decode result
421 if _arguments.has_key('----'):
422 return _arguments['----']
424 _argmap_class_info = {
425 'in_' : 'wrcd',
428 def class_info(self, _object=None, _attributes={}, **_arguments):
429 """class info: (optional) Get information about an object class
430 Required argument: the object class about which information is requested
431 Keyword argument in_: the human language and script system in which to return information
432 Keyword argument _attributes: AppleEvent attribute dictionary
433 Returns: a record containing the object\xd5s properties and elements
435 _code = 'core'
436 _subcode = 'qobj'
438 aetools.keysubst(_arguments, self._argmap_class_info)
439 _arguments['----'] = _object
442 _reply, _arguments, _attributes = self.send(_code, _subcode,
443 _arguments, _attributes)
444 if _arguments.get('errn', 0):
445 raise aetools.Error, aetools.decodeerror(_arguments)
446 # XXXX Optionally decode result
447 if _arguments.has_key('----'):
448 return _arguments['----']
451 class application(aetools.ComponentItem):
452 """application - An application program """
453 want = 'capp'
454 class name(aetools.NProperty):
455 """name - the name of the application """
456 which = 'pnam'
457 want = 'itxt'
458 class frontmost(aetools.NProperty):
459 """frontmost - Is this the frontmost application? """
460 which = 'pisf'
461 want = 'bool'
462 class selection(aetools.NProperty):
463 """selection - the selection visible to the user. Use the \xd4select\xd5 command to set a new selection; use \xd4contents of selection\xd5 to get or change information in the document. """
464 which = 'sele'
465 want = 'csel'
466 class clipboard(aetools.NProperty):
467 """clipboard - the contents of the clipboard for this application """
468 which = 'pcli'
469 want = '****'
470 class version(aetools.NProperty):
471 """version - the version of the application """
472 which = 'vers'
473 want = 'vers'
475 applications = application
477 class document(aetools.ComponentItem):
478 """document - A document of a scriptable application """
479 want = 'docu'
480 class modified(aetools.NProperty):
481 """modified - Has the document been modified since the last save? """
482 which = 'imod'
483 want = 'bool'
485 documents = document
487 class file(aetools.ComponentItem):
488 """file - a file on a disk or server (or a file yet to be created) """
489 want = 'file'
490 class stationery(aetools.NProperty):
491 """stationery - Is the file a stationery file? """
492 which = 'pspd'
493 want = 'bool'
495 files = file
497 class alias(aetools.ComponentItem):
498 """alias - a file on a disk or server. The file must exist when you check the syntax of your script. """
499 want = 'alis'
501 aliases = alias
503 class selection_2d_object(aetools.ComponentItem):
504 """selection-object - A way to refer to the state of the current of the selection. Use the \xd4select\xd5 command to make a new selection. """
505 want = 'csel'
506 class contents(aetools.NProperty):
507 """contents - the information currently selected. Use \xd4contents of selection\xd5 to get or change information in a document. """
508 which = 'pcnt'
509 want = '****'
511 class window(aetools.ComponentItem):
512 """window - A window """
513 want = 'cwin'
514 class bounds(aetools.NProperty):
515 """bounds - the boundary rectangle for the window """
516 which = 'pbnd'
517 want = 'qdrt'
518 class closeable(aetools.NProperty):
519 """closeable - Does the window have a close box? """
520 which = 'hclb'
521 want = 'bool'
522 class titled(aetools.NProperty):
523 """titled - Does the window have a title bar? """
524 which = 'ptit'
525 want = 'bool'
526 class index(aetools.NProperty):
527 """index - the number of the window """
528 which = 'pidx'
529 want = 'long'
530 class floating(aetools.NProperty):
531 """floating - Does the window float? """
532 which = 'isfl'
533 want = 'bool'
534 class modal(aetools.NProperty):
535 """modal - Is the window modal? """
536 which = 'pmod'
537 want = 'bool'
538 class resizable(aetools.NProperty):
539 """resizable - Is the window resizable? """
540 which = 'prsz'
541 want = 'bool'
542 class zoomable(aetools.NProperty):
543 """zoomable - Is the window zoomable? """
544 which = 'iszm'
545 want = 'bool'
546 class zoomed(aetools.NProperty):
547 """zoomed - Is the window zoomed? """
548 which = 'pzum'
549 want = 'bool'
550 class visible(aetools.NProperty):
551 """visible - Is the window visible? """
552 which = 'pvis'
553 want = 'bool'
555 windows = window
557 class insertion_point(aetools.ComponentItem):
558 """insertion point - An insertion location between two objects """
559 want = 'cins'
561 insertion_points = insertion_point
562 application._superclassnames = []
563 application._privpropdict = {
564 'name' : name,
565 'frontmost' : frontmost,
566 'selection' : selection,
567 'clipboard' : clipboard,
568 'version' : version,
570 application._privelemdict = {
572 document._superclassnames = []
573 document._privpropdict = {
574 'modified' : modified,
576 document._privelemdict = {
578 file._superclassnames = []
579 file._privpropdict = {
580 'stationery' : stationery,
582 file._privelemdict = {
584 alias._superclassnames = []
585 alias._privpropdict = {
587 alias._privelemdict = {
589 selection_2d_object._superclassnames = []
590 selection_2d_object._privpropdict = {
591 'contents' : contents,
593 selection_2d_object._privelemdict = {
595 window._superclassnames = []
596 window._privpropdict = {
597 'bounds' : bounds,
598 'closeable' : closeable,
599 'titled' : titled,
600 'index' : index,
601 'floating' : floating,
602 'modal' : modal,
603 'resizable' : resizable,
604 'zoomable' : zoomable,
605 'zoomed' : zoomed,
606 'visible' : visible,
608 window._privelemdict = {
610 insertion_point._superclassnames = []
611 insertion_point._privpropdict = {
613 insertion_point._privelemdict = {
615 class starts_with(aetools.NComparison):
616 """starts with - Starts with """
617 class contains(aetools.NComparison):
618 """contains - Contains """
619 class ends_with(aetools.NComparison):
620 """ends with - Ends with """
621 class _3d_(aetools.NComparison):
622 """= - Equal """
623 class _3e_(aetools.NComparison):
624 """> - Greater than """
625 class _b3_(aetools.NComparison):
626 """\xb3 - Greater than or equal to """
627 class _3c_(aetools.NComparison):
628 """< - Less than """
629 class _b2_(aetools.NComparison):
630 """\xb2 - Less than or equal to """
631 _Enum_savo = {
632 'yes' : 'yes ', # Save objects now
633 'no' : 'no ', # Do not save objects
634 'ask' : 'ask ', # Ask the user whether to save
637 _Enum_kfrm = {
638 'index' : 'indx', # keyform designating indexed access
639 'named' : 'name', # keyform designating named access
640 'id' : 'ID ', # keyform designating access by unique identifier
643 _Enum_styl = {
644 'plain' : 'plan', # Plain
645 'bold' : 'bold', # Bold
646 'italic' : 'ital', # Italic
647 'outline' : 'outl', # Outline
648 'shadow' : 'shad', # Shadow
649 'underline' : 'undl', # Underline
650 'superscript' : 'spsc', # Superscript
651 'subscript' : 'sbsc', # Subscript
652 'strikethrough' : 'strk', # Strikethrough
653 'small_caps' : 'smcp', # Small caps
654 'all_caps' : 'alcp', # All capital letters
655 'all_lowercase' : 'lowc', # Lowercase
656 'condensed' : 'cond', # Condensed
657 'expanded' : 'pexp', # Expanded
658 'hidden' : 'hidn', # Hidden
663 # Indices of types declared in this module
665 _classdeclarations = {
666 'cwin' : window,
667 'file' : file,
668 'csel' : selection_2d_object,
669 'alis' : alias,
670 'capp' : application,
671 'cins' : insertion_point,
672 'docu' : document,
675 _propdeclarations = {
676 'prsz' : resizable,
677 'vers' : version,
678 'pidx' : index,
679 'pvis' : visible,
680 'imod' : modified,
681 'pbnd' : bounds,
682 'sele' : selection,
683 'pisf' : frontmost,
684 'pspd' : stationery,
685 'isfl' : floating,
686 'iszm' : zoomable,
687 'hclb' : closeable,
688 'pcli' : clipboard,
689 'pmod' : modal,
690 'pcnt' : contents,
691 'pnam' : name,
692 'pzum' : zoomed,
693 'ptit' : titled,
696 _compdeclarations = {
697 '< ' : _3c_,
698 'ends' : ends_with,
699 '>= ' : _b3_,
700 'cont' : contains,
701 '<= ' : _b2_,
702 '= ' : _3d_,
703 'bgwt' : starts_with,
704 '> ' : _3e_,
707 _enumdeclarations = {
708 'savo' : _Enum_savo,
709 'styl' : _Enum_styl,
710 'kfrm' : _Enum_kfrm,