def filesharing(): """return the current status of filesharing and whether it is starting up or not: -1 file sharing is off and not starting up 0 file sharing is off and starting up 1 file sharing is on""" status = -1 finder = _getfinder() # see if it is on args = {} attrs = {} args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('fshr'), fr=None) _reply, args, attrs = finder.send("core", "getd", args, attrs) if args.has_key('errn'): raise Error, aetools.decodeerror(args) if args.has_key('----'): if args['----'] == 0: status = -1 else: status = 1 # is it starting up perchance? args = {} attrs = {} args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('fsup'), fr=None) _reply, args, attrs = finder.send("core", "getd", args, attrs) if args.has_key('errn'): raise Error, aetools.decodeerror(args) if args.has_key('----'): if args['----'] == 1: status = 0 return status
def create_a_floppy_from(self, _object, _attributes={}, **_arguments): """create a floppy from: create a floppy disk from a Disk Copy document Required argument: the disk image to make a floppy from Keyword argument signature_verification: Should the DigiSignŽ signature be verified before creating a floppy disk? Keyword argument erase_confirmation: Should the user be asked to confirm the erasure of the previous contents of floppy disks? Keyword argument make_multiple_floppies: Should the user be prompted to create multiple floppy disks? Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'ddsk' _subcode = 'Bfpy' aetools.keysubst(_arguments, self._argmap_create_a_floppy_from) _arguments['----'] = _object aetools.enumsubst(_arguments, 'VSig', _Enum_bool) aetools.enumsubst(_arguments, 'Cfrm', _Enum_bool) aetools.enumsubst(_arguments, 'Mult', _Enum_bool) _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']
def OpenURL(self, _object, _attributes={}, **_arguments): """OpenURL: Opens a URL. Allows for more options than GetURL event Required argument: URL Keyword argument to: file destination Keyword argument toWindow: window iD Keyword argument flags: Binary: any combination of 1, 2 and 4 is allowed: 1 and 2 mean force reload the document. 4 is ignored Keyword argument post_data: Form posting data Keyword argument post_type: MIME type of the posting data. Defaults to application/x-www-form-urlencoded Keyword argument progressApp: Application that will display progress Keyword argument _attributes: AppleEvent attribute dictionary Returns: ID of the loading window """ _code = 'WWW!' _subcode = 'OURL' aetools.keysubst(_arguments, self._argmap_OpenURL) _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']
def mount(self, _object, _attributes={}, **_arguments): """mount: Mounts an Disk Copy image as a disk volume Required argument: a reference to the disk image to be mounted Keyword argument access_mode: the access mode for mounted volume (default is "any", i.e. best possible) Keyword argument checksum_verification: Verify the checksum before mounting? Keyword argument signature_verification: Verify the DigiSignŽ signature before mounting? Keyword argument RAM_caching: Cache the disk image in RAM? (if omitted, don't cache) Keyword argument _attributes: AppleEvent attribute dictionary Returns: a reference to mounted disk """ _code = 'ddsk' _subcode = 'Moun' aetools.keysubst(_arguments, self._argmap_mount) _arguments['----'] = _object aetools.enumsubst(_arguments, 'Acss', _Enum_Acss) aetools.enumsubst(_arguments, 'VChk', _Enum_bool) aetools.enumsubst(_arguments, 'VSig', _Enum_bool) aetools.enumsubst(_arguments, 'Cach', _Enum_bool) _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']
def create(self, _object, _attributes={}, **_arguments): """create: Create a new Disk Copy document Required argument: the name of the volume to create Keyword argument saving_as: the disk image to be created Keyword argument logical_blocks: the number of logical blocks Keyword argument zeroing: Should all blocks on the disk be set to zero? Keyword argument leave_image_mounted: Should the image be mounted after it is created? Keyword argument filesystem: file system to use (Mac OS Standard/compatible, Mac OS Enhanced) Keyword argument _attributes: AppleEvent attribute dictionary Returns: a reference to newly created disk image (or newly mounted disk) """ _code = 'ddsk' _subcode = 'Crea' aetools.keysubst(_arguments, self._argmap_create) _arguments['----'] = _object aetools.enumsubst(_arguments, 'SvAs', _Enum_fss_) aetools.enumsubst(_arguments, 'Blks', _Enum_long) aetools.enumsubst(_arguments, 'Zero', _Enum_bool) aetools.enumsubst(_arguments, 'Moun', _Enum_bool) aetools.enumsubst(_arguments, 'Fsys', _Enum_Fsys) _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']
def duplicate(self, _object, _attributes={}, **_arguments): """duplicate: Duplicate one or more object(s) Required argument: the object(s) to duplicate Keyword argument to: the new location for the object(s) Keyword argument replacing: Specifies whether or not to replace items in the destination that have the same name as items being duplicated Keyword argument routing_suppressed: Specifies whether or not to autoroute items (default is false). Only applies when copying to the system folder. Keyword argument _attributes: AppleEvent attribute dictionary Returns: to the duplicated object(s) """ _code = 'core' _subcode = 'clon' aetools.keysubst(_arguments, self._argmap_duplicate) _arguments['----'] = _object aetools.enumsubst(_arguments, 'alrp', _Enum_bool) aetools.enumsubst(_arguments, 'rout', _Enum_bool) _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']
def filesharing(): """return the current status of filesharing and whether it is starting up or not: -1 file sharing is off and not starting up 0 file sharing is off and starting up 1 file sharing is on""" status = -1 finder = _getfinder() args = {} attrs = {} args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form='prop', seld=aetypes.Type('fshr'), fr=None) _reply, args, attrs = finder.send('core', 'getd', args, attrs) if 'errn' in args: raise Error, aetools.decodeerror(args) if '----' in args: if args['----'] == 0: status = -1 else: status = 1 args = {} attrs = {} args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form='prop', seld=aetypes.Type('fsup'), fr=None) _reply, args, attrs = finder.send('core', 'getd', args, attrs) if 'errn' in args: raise Error, aetools.decodeerror(args) if '----' in args: if args['----'] == 1: status = 0 return status
def move(self, _object, _attributes={}, **_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 replacing: Specifies whether or not to replace items in the destination that have the same name as items being moved Keyword argument positioned_at: Gives a list (in local window coordinates) of positions for the destination items Keyword argument routing_suppressed: Specifies whether or not to autoroute items (default is false). Only applies when moving to the system folder. Keyword argument _attributes: AppleEvent attribute dictionary Returns: to the object(s) after they have been moved """ _code = "core" _subcode = "move" aetools.keysubst(_arguments, self._argmap_move) _arguments["----"] = _object aetools.enumsubst(_arguments, "alrp", _Enum_bool) aetools.enumsubst(_arguments, "mvpl", _Enum_list) aetools.enumsubst(_arguments, "rout", _Enum_bool) _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get("errn", 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key("----"): return _arguments["----"]
def create_SMI(self, _object, _attributes={}, **_arguments): """create SMI: Creates a self-mounting image (SMI) from a list of NDIF disk images Required argument: the self-mounting image to create Keyword argument source_images: a list of references to sources images Keyword argument launching_application: the path to an application to launch Keyword argument launching_document: the path to a document to open Keyword argument version_string: sets the 'vers' 1 resource of the self-mounting image Keyword argument checksum_verification: Should the checksum of the source images be verified before creating the SMI? Keyword argument signature_verification: Should the DigiSignŽ signature of the source images be verified before creating the SMI? Keyword argument image_signing: Should the SMI be given a digital signature when it is created? Keyword argument _attributes: AppleEvent attribute dictionary Returns: a reference to the self-mounting image created """ _code = 'ddsk' _subcode = 'MSMI' aetools.keysubst(_arguments, self._argmap_create_SMI) _arguments['----'] = _object aetools.enumsubst(_arguments, 'VChk', _Enum_bool) aetools.enumsubst(_arguments, 'VSig', _Enum_bool) aetools.enumsubst(_arguments, 'SImg', _Enum_bool) _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']
def _setwindowview(folder_alias, view = 0): """set the windowview""" attrs = {} args = {} if view == 1: _v = aetypes.Type('pnam') elif view == 2: _v = aetypes.Type('lgbu') else: _v = aetypes.Type('iimg') finder = _getfinder() aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form='alis', seld=folder_alias, fr=None) aeobj_1 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form='prop', seld=aetypes.Type('cwnd'), fr=aeobj_0) aeobj_2 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form='prop', seld=aetypes.Type('pvew'), fr=aeobj_1) aeobj_3 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form='prop', seld=_v, fr=None) _code = 'core' _subcode = 'setd' args['----'] = aeobj_2 args['data'] = aeobj_3 _reply, args, attrs = finder.send(_code, _subcode, args, attrs) if 'errn' in args: raise Error, aetools.decodeerror(args) if '----' in args: return args['----'] else: return
def emptytrash(): """empty the trash""" finder = _getfinder() args = {} attrs = {} args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('trsh'), fr=None) _reply, args, attrs = finder.send("fndr", "empt", args, attrs) if args.has_key('errn'): raise aetools.Error, aetools.decodeerror(args)
def emptytrash(): """empty the trash""" finder = _getfinder() args = {} attrs = {} args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form='prop', seld=aetypes.Type('trsh'), fr=None) _reply, args, attrs = finder.send('fndr', 'empt', args, attrs) if 'errn' in args: raise aetools.Error, aetools.decodeerror(args) return
def putaway(object): """puth the object away, whereever it came from.""" finder = _getfinder() args = {} attrs = {} args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('cdis'), form="name", seld=object, fr=None) _reply, args, attrs = talker.send("fndr", "ptwy", args, attrs) if args.has_key('errn'): raise Error, aetools.decodeerror(args) if args.has_key('----'): return args['----']
def _getcomment(object_alias): finder = _getfinder() args = {} attrs = {} aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cobj'), form="alis", seld=object_alias, fr=None) aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('comt'), fr=aeobj_00) args['----'] = aeobj_01 _reply, args, attrs = finder.send("core", "getd", args, attrs) if args.has_key('errn'): raise Error, aetools.decodeerror(args) if args.has_key('----'): return args['----']
def OSversion(): """return the version of the system software""" finder = _getfinder() args = {} attrs = {} aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('ver2'), fr=None) args['----'] = aeobj_00 _reply, args, attrs = finder.send("core", "getd", args, attrs) if args.has_key('errn'): raise Error, aetools.decodeerror(args) if args.has_key('----'): return args['----']
def _processproperty(processname, property): """return the partition size and memory used for processname""" finder = _getfinder() args = {} attrs = {} aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('prcs'), form="name", seld=processname, fr=None) aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type(property), fr=aeobj_00) args['----'] = aeobj_01 _reply, args, attrs = finder.send("core", "getd", args, attrs) if args.has_key('errn'): raise Error, aetools.decodeerror(args) if args.has_key('----'): return args['----']
def putaway(object): """puth the object away, whereever it came from.""" finder = _getfinder() args = {} attrs = {} args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('cdis'), form='name', seld=object, fr=None) _reply, args, attrs = talker.send('fndr', 'ptwy', args, attrs) if 'errn' in args: raise Error, aetools.decodeerror(args) if '----' in args: return args['----'] else: return
def _getlabel(object_alias): """label: Get the label for the object.""" finder = _getfinder() args = {} attrs = {} aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cobj'), form="alis", seld=object_alias, fr=None) aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('labi'), fr=aeobj_00) args['----'] = aeobj_01 _reply, args, attrs = finder.send("core", "getd", args, attrs) if 'errn' in args: raise Error, aetools.decodeerror(args) if '----' in args: return args['----']
def _setcomment(object_alias, comment): finder = _getfinder() args = {} attrs = {} aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cobj'), form="alis", seld=object_alias, fr=None) aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('comt'), fr=aeobj_00) args['----'] = aeobj_01 args["data"] = comment _reply, args, attrs = finder.send("core", "setd", args, attrs) if 'errn' in args: raise Error, aetools.decodeerror(args) if '----' in args: return args['----']
def OSversion(): """return the version of the system software""" finder = _getfinder() args = {} attrs = {} aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form='prop', seld=aetypes.Type('ver2'), fr=None) args['----'] = aeobj_00 _reply, args, attrs = finder.send('core', 'getd', args, attrs) if 'errn' in args: raise Error, aetools.decodeerror(args) if '----' in args: return args['----'] else: return
def _getlocation(object_alias): """_getlocation: get the location of the icon for the object.""" finder = _getfinder() args = {} attrs = {} aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form="alis", seld=object_alias, fr=None) aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('posn'), fr=aeobj_00) args['----'] = aeobj_01 _reply, args, attrs = finder.send("core", "getd", args, attrs) if args.has_key('errn'): raise Error, aetools.decodeerror(args) if args.has_key('----'): pos = args['----'] return pos.h, pos.v
def closewindow(object): """Close a Finder window for folder, Specify by path.""" finder = _getfinder() object = Carbon.File.FSRef(object) object_alias = object.FSNewAliasMinimal() args = {} attrs = {} _code = 'core' _subcode = 'clos' aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form="alis", seld=object_alias, fr=None) args['----'] = aeobj_0 _reply, args, attrs = finder.send(_code, _subcode, args, attrs) if args.has_key('errn'): raise Error, aetools.decodeerror(args)
def openwindow(object): """Open a Finder window for object, Specify object by name or fsspec.""" finder = _getfinder() object = Carbon.File.FSRef(object) object_alias = object.FSNewAliasMinimal() args = {} attrs = {} _code = 'aevt' _subcode = 'odoc' aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form="alis", seld=object_alias, fr=None) args['----'] = aeobj_0 _reply, args, attrs = finder.send(_code, _subcode, args, attrs) if args.has_key('errn'): raise Error, aetools.decodeerror(args)
def _getcomment(object_alias): finder = _getfinder() args = {} attrs = {} aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cobj'), form='alis', seld=object_alias, fr=None) aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form='prop', seld=aetypes.Type('comt'), fr=aeobj_00) args['----'] = aeobj_01 _reply, args, attrs = finder.send('core', 'getd', args, attrs) if 'errn' in args: raise Error, aetools.decodeerror(args) if '----' in args: return args['----'] else: return
def add_to_favorites(self, _object, _attributes = {}, **_arguments): """add to favorites: (NOT AVAILABLE YET) Add the items to the user\xd5s Favorites Required argument: the items to add to the collection of Favorites Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'fndr' _subcode = 'ffav' if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) if _arguments.has_key('----'): return _arguments['----']
def clean_up(self, _object, _attributes = {}, **_arguments): """clean up: (NOT AVAILABLE YET) Arrange items in window nicely (only applies to open windows in icon view that are not kept arranged) Required argument: the window to clean up Keyword argument by: the order in which to clean up the objects (name, index, date, etc.) Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'fndr' _subcode = 'fclu' aetools.keysubst(_arguments, self._argmap_clean_up) _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) if _arguments.has_key('----'): return _arguments['----']
def erase(self, _object, _attributes = {}, **_arguments): """erase: (NOT AVAILABLE) Erase the specified disk(s) Required argument: the items to erase Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'fndr' _subcode = 'fera' if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) if _arguments.has_key('----'): return _arguments['----']
def reveal(self, _object, _attributes = {}, **_arguments): """reveal: Bring the specified object(s) into view Required argument: the object to be made visible Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'misc' _subcode = 'mvis' if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) if _arguments.has_key('----'): return _arguments['----']
def empty(self, _object = None, _attributes = {}, **_arguments): """empty: Empty the trash Required argument: \xd2empty\xd3 and \xd2empty trash\xd3 both do the same thing Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'fndr' _subcode = 'empt' if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) if _arguments.has_key('----'): return _arguments['----']
def eject(self, _object = None, _attributes = {}, **_arguments): """eject: Eject the specified disk(s) Required argument: the disk(s) to eject Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'fndr' _subcode = 'ejct' if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) if _arguments.has_key('----'): return _arguments['----']
def ShowFile(self, _object, _attributes={}, **_arguments): """ShowFile: FileSpec containing data of specified MIME type to be rendered in window specified by Window Identifier. Required argument: The file Keyword argument MIME_Type: MIME type Keyword argument Window_Identifier: Identifier of the target window for the URL. (Can use -1 for top window) Keyword argument URL: URL that allows this document to be reloaded. Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'WWW!' _subcode = 'SHWF' aetools.keysubst(_arguments, self._argmap_ShowFile) _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']
def ShowFile(self, _object, _attributes={}, **_arguments): """ShowFile: Similar to OpenDocuments, except that it specifies the parent URL, and MIME type of the file Required argument: File to open Keyword argument MIME_type: MIME type Keyword argument Window_ID: Window to open the file in Keyword argument URL: Use this as a base URL Keyword argument _attributes: AppleEvent attribute dictionary Returns: Window ID of the loaded window. 0 means ShowFile failed, FFFFFFF means that data was not appropriate type to display in the browser. """ _code = 'WWW!' _subcode = 'SHWF' aetools.keysubst(_arguments, self._argmap_ShowFile) _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']
def _getlocation(object_alias): """_getlocation: get the location of the icon for the object.""" finder = _getfinder() args = {} attrs = {} aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form='alis', seld=object_alias, fr=None) aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form='prop', seld=aetypes.Type('posn'), fr=aeobj_00) args['----'] = aeobj_01 _reply, args, attrs = finder.send('core', 'getd', args, attrs) if 'errn' in args: raise Error, aetools.decodeerror(args) if '----' in args: pos = args['----'] return (pos.h, pos.v) else: return
def _seticon(object_alias, icondata): """set the icondata for object, formatted as produced by _geticon()""" finder = _getfinder() args = {} attrs = {} aeobj_00 = aetypes.ObjectSpecifier(want=aetypes.Type('cobj'), form='alis', seld=object_alias, fr=None) aeobj_01 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form='prop', seld=aetypes.Type('iimg'), fr=aeobj_00) args['----'] = aeobj_01 args['data'] = icondata _reply, args, attrs = finder.send('core', 'setd', args, attrs) if 'errn' in args: raise Error, aetools.decodeerror(args) if '----' in args: return args['----'].data else: return
def check_image(self, _object, _attributes={}, **_arguments): """check image: Check the disk imageÕs internal data structures for any inconsistencies. Works on NDIF, Disk Copy 4.2, DARTŽ, or DiskSet images. Required argument: the disk image to be verified Keyword argument details: Should the disk image details be displayed? Keyword argument _attributes: AppleEvent attribute dictionary Returns: a record containing a boolean (true/false) value if the image passes consistency tests, and the numbers of warnings and errors """ _code = 'ddsk' _subcode = 'Chek' aetools.keysubst(_arguments, self._argmap_check_image) _arguments['----'] = _object aetools.enumsubst(_arguments, 'ChDe', _Enum_bool) _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']
def GetURL(self, _object, _attributes={}, **_arguments): """GetURL: Loads the URL (optionally to disk) Required argument: The url Keyword argument to: file the URL should be loaded into Keyword argument inside: Window the URL should be loaded to Keyword argument from_: Referrer, to be sent with the HTTP request Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'GURL' _subcode = 'GURL' aetools.keysubst(_arguments, self._argmap_GetURL) _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'):
def make(self, _no_object=None, _attributes={}, **_arguments): """make: Make a new object. Keyword argument at: The location at which to insert the object. Keyword argument new: The class of the new object. Keyword argument with_data: The initial data for the object. Keyword argument with_properties: The initial values for properties of the object. Keyword argument _attributes: AppleEvent attribute dictionary Returns: the reply for the command """ _code = 'core' _subcode = 'crel' aetools.keysubst(_arguments, self._argmap_make) if _no_object != None: raise TypeError, 'No direct arg expected' _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']
def duplicate(self, _object, _attributes={}, **_arguments): """duplicate: Duplicate one or more objects Required argument: the object(s) to duplicate Keyword argument to: the new location for the object(s) Keyword argument with_properties: the initial values for properties of the new object that are to be different from the original Keyword argument _attributes: AppleEvent attribute dictionary Returns: to the duplicated object(s) """ _code = 'core' _subcode = 'clon' aetools.keysubst(_arguments, self._argmap_duplicate) _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']
def make(self, _no_object=None, _attributes={}, **_arguments): """make: Make a new element Keyword argument new: the class of the new element Keyword argument at: the location at which to insert the element Keyword argument to: when creating an alias file, the original item to create an alias to or when creating a file viewer window, the target of the window 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' aetools.keysubst(_arguments, self._argmap_make) if _no_object is not None: raise TypeError, 'No direct arg expected' _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) if _arguments.has_key('----'): return _arguments['----'] else: return
def add(self, _object, _attributes={}, **_arguments): """add: add elements to a project or target Required argument: an AE object reference Keyword argument new: the class of the new element or elements to add Keyword argument with_data: the initial data for the element or elements Keyword argument to_targets: the targets to which the new element or elements will be added Keyword argument to_group: the group to which the new element or elements will be added Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'CWIE' _subcode = 'ADDF' aetools.keysubst(_arguments, self._argmap_add) _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']
def close(self, _object, _attributes={}, **_arguments): """close: Close an object. Required argument: the object for the command Keyword argument saving_in: The file in which to save the object. Keyword argument saving: Specifies whether changes should be saved before closing. Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'core' _subcode = 'clos' aetools.keysubst(_arguments, self._argmap_close) _arguments['----'] = _object aetools.enumsubst(_arguments, 'savo', _Enum_savo) _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']
def save(self, _object, _attributes={}, **_arguments): """save: Save an object Required argument: the source object Keyword argument _in: the target object Keyword argument using_format: the format for the target Keyword argument checksum_verification: Should the checksum be verified before saving? Keyword argument signature_verification: Should the DigiSignŽ signature be verified before saving? Keyword argument image_signing: Should the image be signed? Keyword argument leave_image_mounted: Should the image be mounted after saving? Keyword argument percent_free_space: percent free space to reserve (for image folder operation, 0-255%) Keyword argument logical_blocks: number of logical blocks in the image (for image folder operation) Keyword argument zeroing: Should all the blocks in the image be set to zeros? (for image folder operation) Keyword argument _attributes: AppleEvent attribute dictionary Returns: the result of the save operation """ _code = 'core' _subcode = 'save' aetools.keysubst(_arguments, self._argmap_save) _arguments['----'] = _object aetools.enumsubst(_arguments, 'kfil', _Enum_obj_) aetools.enumsubst(_arguments, 'SvAs', _Enum_SvAs) aetools.enumsubst(_arguments, 'VChk', _Enum_bool) aetools.enumsubst(_arguments, 'VSig', _Enum_bool) aetools.enumsubst(_arguments, 'SImg', _Enum_bool) aetools.enumsubst(_arguments, 'Moun', _Enum_bool) aetools.enumsubst(_arguments, 'Slop', _Enum_long) aetools.enumsubst(_arguments, 'Blks', _Enum_long) aetools.enumsubst(_arguments, 'Zero', _Enum_bool) _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']
def _setwindowview(folder_alias, view=0): """set the windowview""" attrs = {} args = {} if view == 1: _v = aetypes.Type('pnam') elif view == 2: _v = aetypes.Type('lgbu') else: _v = aetypes.Type('iimg') finder = _getfinder() aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form='alis', seld=folder_alias, fr=None) aeobj_1 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form='prop', seld=aetypes.Type('cwnd'), fr=aeobj_0) aeobj_2 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form='prop', seld=aetypes.Type('pvew'), fr=aeobj_1) aeobj_3 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form='prop', seld=_v, fr=None) _code = 'core' _subcode = 'setd' args['----'] = aeobj_2 args['data'] = aeobj_3 _reply, args, attrs = finder.send(_code, _subcode, args, attrs) if 'errn' in args: raise Error, aetools.decodeerror(args) if '----' in args: return args['----'] else: return
def OpenURL(self, _object, _attributes={}, **_arguments): """OpenURL: Retrieves URL off the Web. Required argument: Fully-qualified URL Keyword argument to: Target file for saving downloaded data Keyword argument toWindow: Target window for resource at URL (-1 for top window, 0 for new window) Keyword argument Flags: Valid Flags settings are: 1-Ignore the document cache; 2-Ignore the image cache; 4-Operate in background mode. Keyword argument FormData: data to post Keyword argument MIME_Type: MIME type of data being posted Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'WWW!' _subcode = 'OURL' aetools.keysubst(_arguments, self._argmap_OpenURL) _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']
def segment_image(self, _object, _attributes={}, **_arguments): """segment image: Segment a NDIF R/W or R/O image into smaller pieces Required argument: the disk image to be segmented Keyword argument segment_count: the number of image segments to create Keyword argument segment_size: the size of image segments (in blocks) to create Keyword argument segment_name: the root name for each image segment file Keyword argument image_ID: string used to generate a unique image ID to group the segments Keyword argument _attributes: AppleEvent attribute dictionary Returns: a list of references to the image segments created """ _code = 'ddsk' _subcode = 'SGMT' aetools.keysubst(_arguments, self._argmap_segment_image) _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']
def execute_DiskScript(self, _object, _attributes={}, **_arguments): """execute DiskScript: Executes a Disk Copy-specific DiskScript Required argument: a reference to the DiskScript to execute Keyword argument checksum_verification: Should checksums be verified when mounting images referenced in the DiskScript? Keyword argument signature_verification: Should the DigiSignŽ signature of the DiskScript and the images it references be verified? Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'ddsk' _subcode = 'XEQd' aetools.keysubst(_arguments, self._argmap_execute_DiskScript) _arguments['----'] = _object aetools.enumsubst(_arguments, 'VChk', _Enum_bool) aetools.enumsubst(_arguments, 'VSig', _Enum_bool) _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']
def _getwindowsize(folder_alias): """Set the size of a Finder window for folder to (w, h)""" finder = _getfinder() args = {} attrs = {} aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form="alis", seld=folder_alias, fr=None) aeobj_1 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('cwnd'), fr=aeobj_0) aeobj_2 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('posn'), fr=aeobj_1) args['----'] = aeobj_2 _reply, args, attrs = finder.send('core', 'getd', args, attrs) if 'errn' in args: raise Error, aetools.decodeerror(args) if '----' in args: return args['----']
def make(self, _no_object=None, _attributes={}, **_arguments): """make: make a new element Keyword argument new: the class of the new element\xd1keyword 'new' is optional in AppleScript Keyword argument as: the desired types for the data, in order of preference 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' aetools.keysubst(_arguments, self._argmap_make) if _no_object != None: raise TypeError, 'No direct arg expected' _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']
def _getwindowposition(folder_alias): """Get the size of a Finder window for folder, Specify by path.""" finder = _getfinder() args = {} attrs = {} aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'), form="alis", seld=folder_alias, fr=None) aeobj_1 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('cwnd'), fr=aeobj_0) aeobj_2 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('ptsz'), fr=aeobj_1) args['----'] = aeobj_2 _reply, args, attrs = finder.send('core', 'getd', args, attrs) if args.has_key('errn'): raise Error, aetools.decodeerror(args) if args.has_key('----'): return args['----']
def move(self, _object, _attributes={}, **_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 replacing: Specifies whether or not to replace items in the destination that have the same name as items being moved Keyword argument positioned_at: Gives a list (in local window coordinates) of positions for the destination items Keyword argument routing_suppressed: Specifies whether or not to autoroute items (default is false). Only applies when moving to the system folder. Keyword argument _attributes: AppleEvent attribute dictionary Returns: to the object(s) after they have been moved """ _code = 'core' _subcode = 'move' aetools.keysubst(_arguments, self._argmap_move) _arguments['----'] = _object aetools.enumsubst(_arguments, 'alrp', _Enum_bool) aetools.enumsubst(_arguments, 'mvpl', _Enum_list) aetools.enumsubst(_arguments, 'rout', _Enum_bool) _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) if _arguments.has_key('----'): return _arguments['----']
def unregister_window_close(self, _object=None, _attributes={}, **_arguments): """unregister window close: Undo for register window close Required argument: Application signature Keyword argument for_window: window ID Keyword argument _attributes: AppleEvent attribute dictionary Returns: true if successful """ _code = 'WWW!' _subcode = 'UNRC' aetools.keysubst(_arguments, self._argmap_unregister_window_close) _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']
def do_folder_action(self, _object, _attributes={}, **_arguments): """do folder action: Event the Finder sends to the Folder Actions FBA Required argument: the object for the command Keyword argument with_window_size: the new window size for the folder action message to process Keyword argument with_item_list: a list of items for the folder action message to process Keyword argument folder_action_code: the folder action message to process Keyword argument _attributes: AppleEvent attribute dictionary Returns: the reply for the command """ _code = 'faco' _subcode = 'fola' aetools.keysubst(_arguments, self._argmap_do_folder_action) _arguments['----'] = _object aetools.enumsubst(_arguments, 'actn', _Enum_actn) _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']
def filesharing(): status = -1 finder = _getfinder() args = {} attrs = {} args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form='prop', seld=aetypes.Type('fshr'), fr=None) _reply, args, attrs = finder.send('core', 'getd', args, attrs) if 'errn' in args: raise Error, aetools.decodeerror(args) if '----' in args: if args['----'] == 0: status = -1 else: status = 1 args = {} attrs = {} args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form='prop', seld=aetypes.Type('fsup'), fr=None) _reply, args, attrs = finder.send('core', 'getd', args, attrs) if 'errn' in args: raise Error, aetools.decodeerror(args) if '----' in args: if args['----'] == 1: status = 0 return status
def select_floppy_disk_image(self, _no_object=None, _attributes={}, **_arguments): """select floppy disk image: Prompt the user to select a floppy disk image Keyword argument with_prompt: the prompt string to be displayed Keyword argument _attributes: AppleEvent attribute dictionary Returns: a reference to a floppy disk image """ _code = 'UTIL' _subcode = 'SEL4' aetools.keysubst(_arguments, self._argmap_select_floppy_disk_image) if _no_object is not None: raise TypeError, 'No direct arg expected' aetools.enumsubst(_arguments, 'SELp', _Enum_TEXT) _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.has_key('errn'): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']
def select(self, _object=None, _attributes={}, **_arguments): """select: Select the specified object Required argument: the object to select Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'misc' _subcode = 'slct' if _arguments: raise TypeError('No optional args expected') _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error(aetools.decodeerror(_arguments)) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']
def do_script(self, _object=None, _attributes={}, **_arguments): """do script: execute a gnuplot script Required argument: a gnuplot script Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'misc' _subcode = 'dosc' if _arguments: raise TypeError('No optional args expected') _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if 'errn' in _arguments: raise aetools.Error(aetools.decodeerror(_arguments)) # XXXX Optionally decode result if '----' in _arguments: return _arguments['----']
def splot(self, _object=None, _attributes={}, **_arguments): """splot: create a 3-D plot Required argument: data to be plotted Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'GPLT' _subcode = 'splt' if _arguments: raise TypeError('No optional args expected') _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if 'errn' in _arguments: raise aetools.Error(aetools.decodeerror(_arguments)) # XXXX Optionally decode result if '----' in _arguments: return _arguments['----']
def _print(self, _object, _attributes={}, **_arguments): """print: Print the specified object(s) Required argument: Objects to print. Can be a list of files or an object specifier. Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'aevt' _subcode = 'pdoc' if _arguments: raise TypeError('No optional args expected') _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if 'errn' in _arguments: raise aetools.Error(aetools.decodeerror(_arguments)) # XXXX Optionally decode result if '----' in _arguments: return _arguments['----']
def revert(self, _object, _attributes={}, **_arguments): """revert: Revert an object to the most recently saved version Required argument: object to revert Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'misc' _subcode = 'rvrt' if _arguments: raise TypeError('No optional args expected') _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error(aetools.decodeerror(_arguments)) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----']