diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 1995-07-17 11:43:59 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 1995-07-17 11:43:59 (GMT) |
commit | bc608646a88bada9bee0ba2b66964e69777f564a (patch) | |
tree | c109f7d4bc2927c0d0519cd090f2200dbabffabb | |
parent | 5ccd826aabfe3b8770fe7050795bc8e368ff2a4e (diff) | |
download | cpython-bc608646a88bada9bee0ba2b66964e69777f564a.zip cpython-bc608646a88bada9bee0ba2b66964e69777f564a.tar.gz cpython-bc608646a88bada9bee0ba2b66964e69777f564a.tar.bz2 |
The three most important suites, generated by gensuitemodule
-rw-r--r-- | Mac/Lib/toolbox/AppleScript_Suite.py | 1502 | ||||
-rw-r--r-- | Mac/Lib/toolbox/Required_Suite.py | 147 | ||||
-rw-r--r-- | Mac/Lib/toolbox/Standard_Suite.py | 663 |
3 files changed, 2312 insertions, 0 deletions
diff --git a/Mac/Lib/toolbox/AppleScript_Suite.py b/Mac/Lib/toolbox/AppleScript_Suite.py new file mode 100644 index 0000000..73ea0cc --- /dev/null +++ b/Mac/Lib/toolbox/AppleScript_Suite.py @@ -0,0 +1,1502 @@ +"""Suite AppleScript Suite: Goodies for Gustav +Level 1, version 1 + +Generated from Moes:System folder:Extensions:Scripting Additions:Dialects:English Dialect +AETE/AEUT resource version 1/0, language 0, script 0 +""" + +import addpack +addpack.addpack('Tools') +addpack.addpack('bgen') +addpack.addpack('ae') + +import aetools +import MacOS + +_code = 'ascr' + +_Enum_cons = { + 'case' : 'case', # case + 'diacriticals' : 'diac', # diacriticals + 'white_space' : 'whit', # white space + 'hyphens' : 'hyph', # hyphens + 'expansion' : 'expa', # expansion + 'punctuation' : 'punc', # punctuation + 'application_responses' : 'rmte', # remote event replies +} + +_Enum_boov = { + 'true' : 'true', # the true boolean value + 'false' : 'fals', # the false boolean value +} + +_Enum_misc = { + 'current_application' : 'cura', # the current application +} + +class AppleScript_Suite: + + def activate(self, *arguments): + """activate: Bring targeted application program to the front. + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'misc' + _subcode = 'actv' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def log(self, object, *arguments): + """log: Cause a comment to be logged. + Required argument: anything + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'ascr' + _subcode = 'cmnt' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def stop_log(self, *arguments): + """stop log: + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'ToyS' + _subcode = 'log0' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def start_log(self, *arguments): + """start log: + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'ToyS' + _subcode = 'log1' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def copy(self, *arguments): + """copy: Copy an object to the clipboard + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'misc' + _subcode = 'copy' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def do_script(self, object, *arguments): + """do script: Execute a script + Required argument: the script to execute + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'misc' + _subcode = 'dosc' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def idle(self, *arguments): + """idle: Sent to a script application when it is idle + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: Number of seconds to wait for next idle event + """ + _code = 'misc' + _subcode = 'idle' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def launch(self, *arguments): + """launch: Start an application for scripting + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = 'noop' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def tell(self, *arguments): + """tell: Magic tell event for event logging + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = 'tell' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def end_tell(self, *arguments): + """end tell: Start an application for scripting + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = 'tend' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + _argmap_error = { + 'number' : 'errn', + 'partial_result' : 'ptlr', + '_from' : 'erob', + 'to' : 'errt', + } + + def error(self, object, *arguments): + """error: Raise an error + Required argument: anything + Keyword argument number: an error number + Keyword argument partial_result: any partial result occurring before the error + Keyword argument _from: the object that caused the error + Keyword argument to: another parameter to the error + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = 'err ' + + if len(arguments): + object = arguments[0] + arguments = arguments[1:] + else: + object = None + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + aetools.keysubst(arguments, self._argmap_error) + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + _argmap_Call_a5_subroutine = { + 'at' : 'at ', + '_from' : 'from', + '_for' : 'for ', + 'to' : 'to ', + 'thru' : 'thru', + 'through' : 'thgh', + 'by' : 'by ', + 'on' : 'on ', + 'into' : 'into', + 'onto' : 'onto', + 'between' : 'btwn', + 'against' : 'agst', + 'out_of' : 'outo', + 'instead_of' : 'isto', + 'aside_from' : 'asdf', + 'around' : 'arnd', + 'beside' : 'bsid', + 'beneath' : 'bnth', + 'under' : 'undr', + 'over' : 'over', + 'above' : 'abve', + 'below' : 'belw', + 'apart_from' : 'aprt', + 'given' : 'givn', + 'with' : 'with', + 'without' : 'wout', + 'about' : 'abou', + 'since' : 'snce', + 'until' : 'till', + 'returning' : 'Krtn', + } + + def Call_a5_subroutine(self, object, *arguments): + """Call¥subroutine: A subroutine call + Required argument: anything + Keyword argument at: a preposition + Keyword argument _from: a preposition + Keyword argument _for: a preposition + Keyword argument to: a preposition + Keyword argument thru: a preposition + Keyword argument through: a preposition + Keyword argument by: a preposition + Keyword argument on: a preposition + Keyword argument into: a preposition + Keyword argument onto: a preposition + Keyword argument between: a preposition + Keyword argument against: a preposition + Keyword argument out_of: a preposition + Keyword argument instead_of: a preposition + Keyword argument aside_from: a preposition + Keyword argument around: a preposition + Keyword argument beside: a preposition + Keyword argument beneath: a preposition + Keyword argument under: a preposition + Keyword argument over: a preposition + Keyword argument above: a preposition + Keyword argument below: a preposition + Keyword argument apart_from: a preposition + Keyword argument given: a preposition + Keyword argument with: special preposition for setting event properties + Keyword argument without: special preposition for clearing event properties + Keyword argument about: a preposition + Keyword argument since: a preposition + Keyword argument until: a preposition + Keyword argument returning: specifies a pattern to match results to + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = 'psbr' + + if len(arguments): + object = arguments[0] + arguments = arguments[1:] + else: + object = None + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + aetools.keysubst(arguments, self._argmap_Call_a5_subroutine) + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def _3d_(self, object, *arguments): + """=: Equality + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = '= ' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def _ad_(self, object, *arguments): + """: Inequality + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = '\255 ' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def _2b_(self, object, *arguments): + """+: Addition + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = '+ ' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def _2d_(self, object, *arguments): + """-: Subtraction + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = '- ' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def _2a_(self, object, *arguments): + """*: Multiplication + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = '* ' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def _d6_(self, object, *arguments): + """Ö: Division + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = '/ ' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def div(self, object, *arguments): + """div: Quotient + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = 'div ' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def mod(self, object, *arguments): + """mod: Remainder + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = 'mod ' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def _5e_(self, object, *arguments): + """^: Exponentiation + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = '^ ' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def _3e_(self, object, *arguments): + """>: Greater than + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = '> ' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def _b3_(self, object, *arguments): + """³: Greater than or equal to + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = '>= ' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def _3c_(self, object, *arguments): + """<: Less than + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = '< ' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def _b2_(self, object, *arguments): + """²: Less than or equal to + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = '<= ' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def _26_(self, object, *arguments): + """&: Concatenation + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = 'ccat' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def starts_with(self, object, *arguments): + """starts with: Starts with + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = 'bgwt' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def ends_with(self, object, *arguments): + """ends with: Ends with + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = 'ends' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def contains(self, object, *arguments): + """contains: Containment + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = 'cont' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def _and(self, object, *arguments): + """and: Logical conjunction + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = 'AND ' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def _or(self, object, *arguments): + """or: Logical disjunction + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = 'OR ' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def as(self, object, *arguments): + """as: Coercion + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = 'coer' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def _not(self, object, *arguments): + """not: Logical negation + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = 'NOT ' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def negate(self, object, *arguments): + """negate: Numeric negation + Required argument: an AE object reference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: anything + """ + _code = 'ascr' + _subcode = 'neg ' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + +# Class '' ('undf') -- 'the undefined value' + +# Class 'upper case' ('case') -- 'Text with lower case converted to upper case' + +# Class 'machines' ('mach') -- 'every computer' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'machine' ('mach') -- 'A computer' + +# Class 'zones' ('zone') -- 'every AppleTalk zone' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'zone' ('zone') -- 'AppleTalk zone' + +# Class 'seconds' ('scnd') -- 'more than one second' + +# Class 'item' ('cobj') -- 'An item of any type' +# property 'id' ('ID ') 'long' -- 'the unique id number of this object' [mutable] + +# Class 'items' ('cobj') -- 'Every item' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'text items' ('citm') -- '' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'text item' ('citm') -- '' + +# Class 'date' ('ldt ') -- 'Absolute date and time values' +# property 'weekday' ('wkdy') 'wkdy' -- 'the day of a week of a date' [] +# property 'month' ('mnth') 'mnth' -- 'the month of a date' [] +# property 'day' ('day ') 'long' -- 'the day of the month of a date' [] +# property 'year' ('year') 'long' -- 'the year of a date' [] +# property 'time' ('time') 'long' -- 'the time since midnight of a date' [] +# property 'date string' ('dstr') 'TEXT' -- 'the date portion of a date-time value as a string' [] +# property 'time string' ('tstr') 'TEXT' -- 'the time portion of a date-time value as a string' [] + +# Class 'dates' ('ldt ') -- 'every date' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'month' ('mnth') -- 'a month' + +# Class 'months' ('mnth') -- 'every month' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'January' ('jan ') -- "It's June in January..." + +# Class 'February' ('feb ') -- 'the month of February' + +# Class 'March' ('mar ') -- 'the month of March' + +# Class 'April' ('apr ') -- 'the month of April' + +# Class 'May' ('may ') -- 'the very merry month of May' + +# Class 'June' ('jun ') -- 'the month of June' + +# Class 'July' ('jul ') -- 'the month of July' + +# Class 'August' ('aug ') -- 'the month of August' + +# Class 'September' ('sep ') -- 'the month of September' + +# Class 'October' ('oct ') -- 'the month of October' + +# Class 'November' ('nov ') -- 'the month of November' + +# Class 'December' ('dec ') -- 'the month of December' + +# Class 'weekday' ('wkdy') -- 'a weekday' + +# Class 'weekdays' ('wkdy') -- 'every weekday' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'Sunday' ('sun ') -- 'Sunday Bloody Sunday' + +# Class 'Monday' ('mon ') -- 'Blue Monday' + +# Class 'Tuesday' ('tue ') -- 'Ruby Tuesday' + +# Class 'Wednesday' ('wed ') -- 'Wednesday Week' + +# Class 'Thursday' ('thu ') -- 'Thursday Afternoon' + +# Class 'Friday' ('fri ') -- 'Friday' + +# Class 'Saturday' ('sat ') -- "Saturday Night's Alright for Fighting" + +# Class 'RGB color' ('cRGB') -- 'Three numbers specifying red, green, blue color values' + +# Class 'RGB colors' ('cRGB') -- 'every RGB color' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'integer' ('long') -- 'An integral number' + +# Class 'integers' ('long') -- 'every integer' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'boolean' ('bool') -- 'A true or false value' + +# Class 'booleans' ('bool') -- 'every boolean' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'real' ('doub') -- 'A real number' + +# Class 'reals' ('doub') -- 'every real' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'list' ('list') -- 'An ordered collection of items' +# property 'length' ('leng') 'long' -- 'the length of a list' [] + +# Class 'lists' ('list') -- 'every list' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'linked list' ('llst') -- 'An ordered collection of items' +# property 'length' ('leng') 'long' -- 'the length of a list' [] + +# Class 'linked lists' ('llst') -- 'every linked list' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'vector' ('vect') -- 'An ordered collection of items' +# property 'length' ('leng') 'long' -- 'the length of a list' [] + +# Class 'vectors' ('vect') -- 'every vector' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'record' ('reco') -- 'A set of labeled items' + +# Class 'records' ('reco') -- 'every record' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'script' ('scpt') -- 'An AppleScript script' +# property 'parent' ('pare') 'scpt' -- 'the parent of a script' [] + +# Class 'scripts' ('scpt') -- 'every script' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'string' ('TEXT') -- 'a sequence of characters' + +# Class 'strings' ('TEXT') -- 'every string' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'styled text' ('STXT') -- 'a sequence of characters with style' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'number' ('nmbr') -- 'an integer or floating point number' + +# Class 'numbers' ('nmbr') -- 'every number' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'class' ('pcls') -- 'the type of a value' +# property 'inherits' ('c@#^') 'pcls' -- 'classes to inherit properties from' [] + +# Class 'classes' ('pcls') -- 'every class' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'event' ('evnt') -- 'an AppleEvents event' + +# Class 'events' ('evnt') -- 'every event' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'property' ('prop') -- 'an AppleEvents property' + +# Class 'properties' ('prop') -- 'every property' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'constant' ('enum') -- 'A constant value' + +# Class 'constants' ('enum') -- 'every constant' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'preposition' ('prep') -- 'an AppleEvents preposition' + +# Class 'prepositions' ('prep') -- 'every preposition' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'key' ('keyf') -- 'an AppleEvents key form' + +# Class 'keys' ('keyf') -- 'every key' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'picture' ('PICT') -- 'A picture' + +# Class 'pictures' ('PICT') -- 'every picture' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'reference' ('obj ') -- 'An AppleScript reference' + +# Class 'references' ('obj ') -- 'every reference' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'data' ('rdat') -- 'An AppleScript raw data object' + +# Class 'handler' ('hand') -- 'An AppleScript handler' + +# Class 'handlers' ('hand') -- 'every handler' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'list or record' ('lr ') -- 'a list or record' + +# Class 'list or string' ('ls ') -- 'a list or string' + +# Class 'list, record or text' ('lrs ') -- 'a list, record or text' + +# Class 'number or date' ('nd ') -- 'a number or date' + +# Class 'number, date or text' ('nds ') -- 'a number, date or text' + +# Class 'alias' ('alis') -- 'a reference to an existing file' + +# Class 'aliases' ('alis') -- 'every alias' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'application' ('capp') -- 'specifies global properties of AppleScript' +# property 'result' ('rslt') 'cobj' -- 'the last result of evaluation' [] +# property 'space' ('spac') 'TEXT' -- 'a space character' [] +# property 'return' ('ret ') 'TEXT' -- 'a return character' [] +# property 'tab' ('tab ') 'TEXT' -- 'a tab character' [] +# property 'minutes' ('min ') 'TEXT' -- 'the number of seconds in a minute' [] +# property 'hours' ('hour') 'TEXT' -- 'the number of seconds in an hour' [] +# property 'days' ('days') 'TEXT' -- 'the number of seconds in a day' [] +# property 'weeks' ('week') 'TEXT' -- 'the number of seconds in a week' [] +# property 'pi' ('pi ') 'doub' -- 'the constant pi' [] +# property 'print length' ('prln') 'long' -- 'the maximum length to print' [] +# property 'print depth' ('prdp') 'long' -- 'the maximum depth to print' [] +# property 'reverse' ('rvse') 'list' -- 'the reverse of a list' [] +# property 'rest' ('rest') 'list' -- 'the rest of a list' [] +# property 'text item delimiters' ('txdl') 'list' -- 'the text item delimiters of a string' [] +# property 'AppleScript' ('ascr') 'scpt' -- 'the top-level script object' [] + +# Class 'applications' ('capp') -- 'every application' +# property '' ('c@#!') 'type' -- '' [0] + +# Class 'app' ('capp') -- 'Short name for application' + +# Class 'version' ('vers') -- 'a version value' + +# Class 'writing code info' ('citl') -- 'Script code and language code of text run' +# property 'script code' ('pscd') 'shor' -- 'the script code for the text' [] +# property 'language code' ('plcd') 'shor' -- 'the language code for the text' [] + +# Class 'writing code infos' ('citl') -- 'every writing code info' +# property '' ('c@#!') 'type' -- '' [0] diff --git a/Mac/Lib/toolbox/Required_Suite.py b/Mac/Lib/toolbox/Required_Suite.py new file mode 100644 index 0000000..4f317c9 --- /dev/null +++ b/Mac/Lib/toolbox/Required_Suite.py @@ -0,0 +1,147 @@ +"""Suite Required Suite: Terms that every application should support +Level 1, version 1 + +Generated from Moes:System folder:Extensions:Scripting Additions:Dialects:English Dialect +AETE/AEUT resource version 1/0, language 0, script 0 +""" + +import addpack +addpack.addpack('Tools') +addpack.addpack('bgen') +addpack.addpack('ae') + +import aetools +import MacOS + +_code = 'reqd' + +class Required_Suite: + + def open(self, object, *arguments): + """open: Open the specified object(s) + Required argument: list of objects to open + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'aevt' + _subcode = 'odoc' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def _print(self, object, *arguments): + """print: Print the specified object(s) + Required argument: list of objects to print + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'aevt' + _subcode = 'pdoc' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def quit(self, *arguments): + """quit: Quit application + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'aevt' + _subcode = 'quit' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def run(self, *arguments): + """run: Sent to an application when it is double-clicked + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'aevt' + _subcode = 'oapp' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + diff --git a/Mac/Lib/toolbox/Standard_Suite.py b/Mac/Lib/toolbox/Standard_Suite.py new file mode 100644 index 0000000..ca7908b --- /dev/null +++ b/Mac/Lib/toolbox/Standard_Suite.py @@ -0,0 +1,663 @@ +"""Suite Standard Suite: Common terms for most applications +Level 1, version 1 + +Generated from Moes:Programma's:Speech Technology:Scriptable Text Editor +AETE/AEUT resource version 1/0, language 0, script 0 +""" + +import addpack +addpack.addpack('Tools') +addpack.addpack('bgen') +addpack.addpack('ae') + +import aetools +import MacOS + +_code = 'CoRe' + +_Enum_savo = { + 'yes' : 'yes ', # Save objects now + 'no' : 'no ', # Do not save objects + 'ask' : 'ask ', # Ask the user whether to save +} + +_Enum_kfrm = { + 'index' : 'indx', # keyform designating indexed access + 'named' : 'name', # keyform designating named access + 'id' : 'ID ', # keyform designating identifer access +} + +class Standard_Suite: + + _argmap_close = { + 'saving' : 'savo', + 'saving_in' : 'kfil', + } + + def close(self, object, *arguments): + """close: Close an object + Required argument: the object to close + Keyword argument saving: Specifies whether or not changes should be saved before closing + Keyword argument saving_in: the file in which to save the object + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'core' + _subcode = 'clos' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + aetools.keysubst(arguments, self._argmap_close) + aetools.enumsubst(arguments, 'savo', _Enum_savo) + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + _argmap_count = { + 'each' : 'kocl', + } + + def count(self, object, *arguments): + """count: Return the number of elements of a particular class within an object + Required argument: the object whose elements are to be counted + Keyword argument each: the class of the elements to be counted. Keyword 'each' is optional in AppleScript + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: the number of elements + """ + _code = 'core' + _subcode = 'cnte' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + aetools.keysubst(arguments, self._argmap_count) + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + _argmap_data_size = { + 'as' : 'rtyp', + } + + def data_size(self, object, *arguments): + """data size: Return the size in bytes of an object + Required argument: the object whose data size is to be returned + Keyword argument as: the data type for which the size is calculated + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: the size of the object in bytes + """ + _code = 'core' + _subcode = 'dsiz' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + aetools.keysubst(arguments, self._argmap_data_size) + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def delete(self, object, *arguments): + """delete: Delete an element from an object + Required argument: the element to delete + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'core' + _subcode = 'delo' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + _argmap_duplicate = { + 'to' : 'insh', + } + + def duplicate(self, object, *arguments): + """duplicate: Duplicate object(s) + Required argument: the object(s) to duplicate + Keyword argument to: the new location for the object(s) + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: to the duplicated object(s) + """ + _code = 'core' + _subcode = 'clon' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + aetools.keysubst(arguments, self._argmap_duplicate) + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def exists(self, object, *arguments): + """exists: Verify if an object exists + Required argument: the object in question + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: true if it exists, false if not + """ + _code = 'core' + _subcode = 'doex' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + _argmap_get = { + 'as' : 'rtyp', + } + + def get(self, object, *arguments): + """get: Get the data for an object + Required argument: the object whose data is to be returned + Keyword argument as: the desired types for the data, in order of preference + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: The data from the object + """ + _code = 'core' + _subcode = 'getd' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + aetools.keysubst(arguments, self._argmap_get) + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + _argmap_make = { + 'new' : 'kocl', + 'at' : 'insh', + 'with_data' : 'data', + 'with_properties' : 'prdt', + } + + def make(self, *arguments): + """make: Make a new element + Keyword argument new: the class of the new element. Keyword 'new' is optional in AppleScript + Keyword argument at: the location at which to insert the element + Keyword argument with_data: the initial data for the element + Keyword argument with_properties: the initial values for the properties of the element + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: to the new object(s) + """ + _code = 'core' + _subcode = 'crel' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + aetools.keysubst(arguments, self._argmap_make) + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + _argmap_move = { + 'to' : 'insh', + } + + def move(self, object, *arguments): + """move: Move object(s) to a new location + Required argument: the object(s) to move + Keyword argument to: the new location for the object(s) + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: to the object(s) after they have been moved + """ + _code = 'core' + _subcode = 'move' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + aetools.keysubst(arguments, self._argmap_move) + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def open(self, object, *arguments): + """open: Open the specified object(s) + Required argument: list of objects to open + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'aevt' + _subcode = 'odoc' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + def _print(self, object, *arguments): + """print: Print the specified object(s) + Required argument: list of objects to print + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'aevt' + _subcode = 'pdoc' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + _argmap_quit = { + 'saving' : 'savo', + } + + def quit(self, *arguments): + """quit: Quit an application program + Keyword argument saving: Specifies whether or not to save currently open documents + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'aevt' + _subcode = 'quit' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + aetools.keysubst(arguments, self._argmap_quit) + aetools.enumsubst(arguments, 'savo', _Enum_savo) + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + _argmap_save = { + '_in' : 'kfil', + 'as' : 'fltp', + } + + def save(self, object, *arguments): + """save: Save an object + Required argument: the object to save + Keyword argument _in: the file in which to save the object + Keyword argument as: the file type of the document in which to save the data + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'core' + _subcode = 'save' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + aetools.keysubst(arguments, self._argmap_save) + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + _argmap_set = { + 'to' : 'data', + } + + def set(self, object, *arguments): + """set: Set an object's data + Required argument: the object to change + Keyword argument to: the new value + Keyword argument _attributes: AppleEvent attribute dictionary + """ + _code = 'core' + _subcode = 'setd' + + if len(arguments) > 1: + raise TypeError, 'Too many arguments' + if arguments: + arguments = arguments[0] + if type(arguments) <> type({}): + raise TypeError, 'Must be a mapping' + else: + arguments = {} + arguments['----'] = object + + if arguments.has_key('_attributes'): + attributes = arguments['_attributes'] + del arguments['_attributes'] + else: + attributes = {} + + aetools.keysubst(arguments, self._argmap_set) + + reply, arguments, attributes = self.send(_code, _subcode, + arguments, attributes) + if arguments.has_key('errn'): + raise MacOS.Error, aetools.decodeerror(arguments) + # XXXX Optionally decode result + if arguments.has_key('----'): + return arguments['----'] + + +# Class 'application' ('capp') -- 'An application program' +# property 'clipboard' ('pcli') '****' -- 'contents of the clipboard' [mutable list] +# property 'frontmost' ('pisf') 'bool' -- 'Is this the frontmost application?' [] +# property 'name' ('pnam') 'itxt' -- 'the name' [] +# property 'selection' ('sele') 'csel' -- 'the selection visible to the user' [mutable] +# property 'version' ('vers') 'vers' -- 'the version of the application' [] +# property 'text item delimiters' ('txdl') 'list' -- 'a list of all the text item delimiters' [mutable] +# element 'docu' as ['indx', 'name', 'rang', 'test'] +# element 'cwin' as ['indx', 'name', 'rang', 'test'] + +# Class 'applications' ('capp') -- 'Every application' +# property 'class attributes' ('c@#!') 'type' -- 'special class attributes' [0] + +# Class 'document' ('docu') -- 'A document' +# property 'bounds' ('pbnd') 'qdrt' -- 'the boundary rectangle for the document' [mutable] +# property 'closeable' ('hclb') 'bool' -- 'Does the document have a close box?' [] +# property 'titled' ('ptit') 'bool' -- 'Does the document have a title bar?' [] +# property 'index' ('pidx') 'long' -- 'the number of the document' [mutable] +# property 'floating' ('isfl') 'bool' -- 'Does the document float?' [] +# property 'modal' ('pmod') 'bool' -- 'Is the document modal?' [] +# property 'resizable' ('prsz') 'bool' -- 'Is the document resizable?' [] +# property 'zoomable' ('iszm') 'bool' -- 'Is the document zoomable?' [] +# property 'zoomed' ('pzum') 'bool' -- 'Is the document zoomed?' [mutable] +# property 'name' ('pnam') 'itxt' -- 'the title of the document' [mutable] +# property 'selection' ('sele') 'csel' -- 'the selection visible to the user' [mutable] +# property 'visible' ('pvis') 'bool' -- 'Is the document visible?' [] +# property 'modified' ('imod') 'bool' -- 'Has the document been modified since the last save?' [] +# property 'position' ('ppos') 'QDpt' -- 'upper left coordinates of the document' [] +# element 'cha ' as ['indx', 'rele', 'rang', 'test'] +# element 'cins' as ['rele'] +# element 'cpar' as ['indx', 'rele', 'rang', 'test'] +# element 'ctxt' as ['rang'] +# element 'citm' as ['indx', 'rele', 'rang', 'test'] +# element 'cwor' as ['indx', 'rele', 'rang', 'test'] + +# Class 'documents' ('docu') -- 'Every document' +# property 'class attributes' ('c@#!') 'type' -- 'special class attributes' [0] + +# Class 'file' ('file') -- 'A file' + +# Class 'files' ('file') -- 'Every file' +# property 'class attributes' ('c@#!') 'type' -- 'special class attributes' [0] + +# Class 'insertion point' ('cins') -- 'An insertion location between two objects' +# property 'length' ('leng') 'long' -- 'length of text object (in characters)' [] +# property 'offset' ('ofse') 'long' -- 'offset of a text object from the beginning of the document (first char has offset 1)' [] +# property 'font' ('font') 'ctxt' -- 'the name of the font' [mutable] +# property 'size' ('ptsz') 'long' -- 'the size in points' [mutable] +# property 'style' ('txst') 'tsty' -- 'the text style' [mutable] +# property 'uniform styles' ('ustl') 'tsty' -- 'the text style' [] +# property 'writing code' ('psct') 'intl' -- 'the script system and language' [mutable] + +# Class 'insertion points' ('cins') -- 'Every insertion location' +# property 'class attributes' ('c@#!') 'type' -- 'special class attributes' [0] + +# Class 'selection-object' ('csel') -- 'the selection visible to the user' +# property 'contents' ('pcnt') 'type' -- 'the contents of the selection' [mutable] +# property 'length' ('leng') 'long' -- 'length of text object (in characters)' [] +# property 'offset' ('ofse') 'long' -- 'offset of a text object from the beginning of the document (first char has offset 1)' [] +# property 'font' ('font') 'ctxt' -- 'the name of the font' [mutable] +# property 'size' ('ptsz') 'long' -- 'the size in points' [mutable] +# property 'style' ('txst') 'tsty' -- 'the text style' [mutable] +# property 'uniform styles' ('ustl') 'tsty' -- 'the text style' [] +# property 'writing code' ('psct') 'intl' -- 'the script system and language' [mutable] +# element 'cha ' as ['indx', 'rele', 'rang', 'test'] +# element 'cpar' as ['indx', 'rele', 'rang', 'test'] +# element 'ctxt' as ['rang'] +# element 'citm' as ['indx', 'rele', 'rang', 'test'] +# element 'cwor' as ['indx', 'rele', 'rang', 'test'] + +# Class 'window' ('cwin') -- 'A window' +# property 'bounds' ('pbnd') 'qdrt' -- 'the boundary rectangle for the window' [mutable] +# property 'closeable' ('hclb') 'bool' -- 'Does the window have a close box?' [] +# property 'titled' ('ptit') 'bool' -- 'Does the window have a title bar?' [] +# property 'index' ('pidx') 'long' -- 'the number of the window' [mutable] +# property 'floating' ('isfl') 'bool' -- 'Does the window float?' [] +# property 'modal' ('pmod') 'bool' -- 'Is the window modal?' [] +# property 'resizable' ('prsz') 'bool' -- 'Is the window resizable?' [] +# property 'zoomable' ('iszm') 'bool' -- 'Is the window zoomable?' [] +# property 'zoomed' ('pzum') 'bool' -- 'Is the window zoomed?' [mutable] +# property 'name' ('pnam') 'itxt' -- 'the title of the window' [mutable] +# property 'selection' ('sele') 'csel' -- 'the selection visible to the user' [mutable] +# property 'visible' ('pvis') 'bool' -- 'is the window visible?' [] +# property 'modified' ('imod') 'bool' -- 'has the window been modified since the last save?' [] +# property 'position' ('ppos') 'QDpt' -- 'upper left coordinates of window' [] +# element 'cha ' as ['indx', 'rele', 'rang', 'test'] +# element 'cins' as ['rele'] +# element 'cpar' as ['indx', 'rele', 'rang', 'test'] +# element 'ctxt' as ['rang'] +# element 'citm' as ['indx', 'rele', 'rang', 'test'] +# element 'cwor' as ['indx', 'rele', 'rang', 'test'] + +# Class 'windows' ('cwin') -- 'Every window' +# property 'class attributes' ('c@#!') 'type' -- 'special class attributes' [0] |