| 
									
										
										
										
											2003-03-30 22:41:53 +00:00
										 |  |  | """Suite Folder Actions Suite: Terms and Events for controlling Folder Actions
 | 
					
						
							|  |  |  | Level 1, version 1 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Generated from /System/Library/CoreServices/System Events.app | 
					
						
							|  |  |  | AETE/AEUT resource version 1/0, language 0, script 0 | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import aetools | 
					
						
							|  |  |  | import MacOS | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | _code = 'faco' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class Folder_Actions_Suite_Events: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-04-12 22:27:11 +00:00
										 |  |  |     _argmap_attach_action_to = { | 
					
						
							|  |  |  |         'using' : 'faal', | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def attach_action_to(self, _object, _attributes={}, **_arguments): | 
					
						
							|  |  |  |         """attach action to: Attach an action to a folder
 | 
					
						
							|  |  |  |         Required argument: the object for the command | 
					
						
							|  |  |  |         Keyword argument using: a file containing the script to attach | 
					
						
							|  |  |  |         Keyword argument _attributes: AppleEvent attribute dictionary | 
					
						
							|  |  |  |         Returns: the reply for the command | 
					
						
							|  |  |  |         """
 | 
					
						
							|  |  |  |         _code = 'faco' | 
					
						
							|  |  |  |         _subcode = 'atfa' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         aetools.keysubst(_arguments, self._argmap_attach_action_to) | 
					
						
							|  |  |  |         _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 attached_scripts(self, _object, _attributes={}, **_arguments): | 
					
						
							|  |  |  |         """attached scripts: List the actions attached to a folder
 | 
					
						
							|  |  |  |         Required argument: the object for the command | 
					
						
							|  |  |  |         Keyword argument _attributes: AppleEvent attribute dictionary | 
					
						
							|  |  |  |         Returns: the reply for the command | 
					
						
							|  |  |  |         """
 | 
					
						
							|  |  |  |         _code = 'faco' | 
					
						
							|  |  |  |         _subcode = 'lact' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         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['----'] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     _argmap_do_folder_action = { | 
					
						
							|  |  |  |         'with_window_size' : 'fnsz', | 
					
						
							|  |  |  |         'with_item_list' : 'flst', | 
					
						
							|  |  |  |         'folder_action_code' : 'actn', | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     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['----'] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     _argmap_edit_action_of = { | 
					
						
							|  |  |  |         'using_action_name' : 'snam', | 
					
						
							|  |  |  |         'using_action_number' : 'indx', | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def edit_action_of(self, _object, _attributes={}, **_arguments): | 
					
						
							|  |  |  |         """edit action of: Edit as action of a folder
 | 
					
						
							|  |  |  |         Required argument: the object for the command | 
					
						
							|  |  |  |         Keyword argument using_action_name: ...or the name of the action to edit | 
					
						
							|  |  |  |         Keyword argument using_action_number: the index number of the action to edit... | 
					
						
							|  |  |  |         Keyword argument _attributes: AppleEvent attribute dictionary | 
					
						
							|  |  |  |         Returns: the reply for the command | 
					
						
							|  |  |  |         """
 | 
					
						
							|  |  |  |         _code = 'faco' | 
					
						
							|  |  |  |         _subcode = 'edfa' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         aetools.keysubst(_arguments, self._argmap_edit_action_of) | 
					
						
							|  |  |  |         _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['----'] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     _argmap_remove_action_from = { | 
					
						
							|  |  |  |         'using_action_name' : 'snam', | 
					
						
							|  |  |  |         'using_action_number' : 'indx', | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def remove_action_from(self, _object, _attributes={}, **_arguments): | 
					
						
							|  |  |  |         """remove action from: Remove a folder action from a folder
 | 
					
						
							|  |  |  |         Required argument: the object for the command | 
					
						
							|  |  |  |         Keyword argument using_action_name: ...or the name of the action to remove | 
					
						
							|  |  |  |         Keyword argument using_action_number: the index number of the action to remove... | 
					
						
							|  |  |  |         Keyword argument _attributes: AppleEvent attribute dictionary | 
					
						
							|  |  |  |         Returns: the reply for the command | 
					
						
							|  |  |  |         """
 | 
					
						
							|  |  |  |         _code = 'faco' | 
					
						
							|  |  |  |         _subcode = 'rmfa' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         aetools.keysubst(_arguments, self._argmap_remove_action_from) | 
					
						
							|  |  |  |         _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['----'] | 
					
						
							| 
									
										
										
										
											2003-03-30 22:41:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-13 14:31:19 +00:00
										 |  |  | class application(aetools.ComponentItem): | 
					
						
							|  |  |  |     """application - The Folder Actions Suite host program """ | 
					
						
							|  |  |  |     want = 'capp' | 
					
						
							| 
									
										
										
										
											2003-04-01 22:05:14 +00:00
										 |  |  | class _Prop__3c_Inheritance_3e_(aetools.NProperty): | 
					
						
							| 
									
										
										
										
											2003-04-12 22:27:11 +00:00
										 |  |  |     """<Inheritance> - All of the properties of the superclass. """ | 
					
						
							|  |  |  |     which = 'c@#^' | 
					
						
							| 
									
										
										
										
											2003-06-13 14:31:19 +00:00
										 |  |  |     want = 'capp' | 
					
						
							|  |  |  | _3c_Inheritance_3e_ = _Prop__3c_Inheritance_3e_() | 
					
						
							|  |  |  | class _Prop_folder_actions_enabled(aetools.NProperty): | 
					
						
							|  |  |  |     """folder actions enabled - Are Folder Actions currently being processed? """ | 
					
						
							|  |  |  |     which = 'faen' | 
					
						
							| 
									
										
										
										
											2003-04-12 22:27:11 +00:00
										 |  |  |     want = 'bool' | 
					
						
							| 
									
										
										
										
											2003-06-13 14:31:19 +00:00
										 |  |  | folder_actions_enabled = _Prop_folder_actions_enabled() | 
					
						
							|  |  |  | class _Prop_properties(aetools.NProperty): | 
					
						
							|  |  |  |     """properties - every property of the Folder Actions Suite host program """ | 
					
						
							|  |  |  |     which = 'pALL' | 
					
						
							|  |  |  |     want = '****' | 
					
						
							|  |  |  | properties = _Prop_properties() | 
					
						
							|  |  |  | #        element 'cdis' as ['name', 'indx', 'rele', 'rang', 'test'] | 
					
						
							|  |  |  | #        element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] | 
					
						
							|  |  |  | #        element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] | 
					
						
							|  |  |  | #        element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID  '] | 
					
						
							|  |  |  | #        element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] | 
					
						
							|  |  |  | #        element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] | 
					
						
							|  |  |  | #        element 'foac' as ['name', 'indx', 'rele', 'rang', 'test'] | 
					
						
							|  |  |  | #        element 'logi' as ['name', 'indx', 'rele', 'rang', 'test'] | 
					
						
							|  |  |  | #        element 'pcap' as ['name', 'indx', 'rele', 'rang', 'test'] | 
					
						
							|  |  |  | #        element 'pcda' as ['name', 'indx', 'rele', 'rang', 'test'] | 
					
						
							|  |  |  | #        element 'prcs' as ['name', 'indx', 'rele', 'rang', 'test'] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | applications = application | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class folder_action(aetools.ComponentItem): | 
					
						
							|  |  |  |     """folder action - An action attached to a folder in the file system """ | 
					
						
							|  |  |  |     want = 'foac' | 
					
						
							| 
									
										
										
										
											2003-04-01 22:05:14 +00:00
										 |  |  | class _Prop_name(aetools.NProperty): | 
					
						
							| 
									
										
										
										
											2003-04-12 22:27:11 +00:00
										 |  |  |     """name - the name of the folder action, which is also the name of the folder """ | 
					
						
							|  |  |  |     which = 'pnam' | 
					
						
							|  |  |  |     want = 'utxt' | 
					
						
							| 
									
										
										
										
											2003-04-01 22:05:14 +00:00
										 |  |  | class _Prop_path(aetools.NProperty): | 
					
						
							| 
									
										
										
										
											2003-04-12 22:27:11 +00:00
										 |  |  |     """path - the path to the folder to which the folder action applies """ | 
					
						
							|  |  |  |     which = 'ppth' | 
					
						
							|  |  |  |     want = '****' | 
					
						
							| 
									
										
										
										
											2003-04-01 22:05:14 +00:00
										 |  |  | class _Prop_volume(aetools.NProperty): | 
					
						
							| 
									
										
										
										
											2003-04-12 22:27:11 +00:00
										 |  |  |     """volume - the volume on which the folder action resides """ | 
					
						
							|  |  |  |     which = 'volu' | 
					
						
							|  |  |  |     want = 'utxt' | 
					
						
							| 
									
										
										
										
											2003-03-30 22:41:53 +00:00
										 |  |  | #        element 'scpt' as ['name', 'indx', 'rele', 'rang', 'test'] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | folder_actions = folder_action | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class script(aetools.ComponentItem): | 
					
						
							| 
									
										
										
										
											2003-04-12 22:27:11 +00:00
										 |  |  |     """script - A script invoked by a folder action """ | 
					
						
							|  |  |  |     want = 'scpt' | 
					
						
							| 
									
										
										
										
											2003-04-01 22:05:14 +00:00
										 |  |  | class _Prop_POSIX_path(aetools.NProperty): | 
					
						
							| 
									
										
										
										
											2003-04-12 22:27:11 +00:00
										 |  |  |     """POSIX path - the POSIX file system path of the disk """ | 
					
						
							|  |  |  |     which = 'posx' | 
					
						
							|  |  |  |     want = 'utxt' | 
					
						
							| 
									
										
										
										
											2003-03-30 22:41:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | scripts = script | 
					
						
							| 
									
										
										
										
											2003-06-13 14:31:19 +00:00
										 |  |  | application._superclassnames = [] | 
					
						
							|  |  |  | import Disk_Folder_File_Suite | 
					
						
							| 
									
										
										
										
											2003-03-30 22:41:53 +00:00
										 |  |  | import Standard_Suite | 
					
						
							| 
									
										
										
										
											2003-06-13 14:31:19 +00:00
										 |  |  | import Login_Items_Suite | 
					
						
							|  |  |  | import Processes_Suite | 
					
						
							|  |  |  | application._privpropdict = { | 
					
						
							|  |  |  |     '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, | 
					
						
							|  |  |  |     'folder_actions_enabled' : _Prop_folder_actions_enabled, | 
					
						
							|  |  |  |     'properties' : _Prop_properties, | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | application._privelemdict = { | 
					
						
							|  |  |  |     'application_process' : Processes_Suite.application_process, | 
					
						
							|  |  |  |     'desk_accessory_process' : Processes_Suite.desk_accessory_process, | 
					
						
							|  |  |  |     'disk' : Disk_Folder_File_Suite.disk, | 
					
						
							|  |  |  |     'document' : Standard_Suite.document, | 
					
						
							|  |  |  |     'file' : Disk_Folder_File_Suite.file, | 
					
						
							|  |  |  |     'folder' : Disk_Folder_File_Suite.folder, | 
					
						
							|  |  |  |     'folder_action' : folder_action, | 
					
						
							|  |  |  |     'item' : Disk_Folder_File_Suite.item, | 
					
						
							|  |  |  |     'login_item' : Login_Items_Suite.login_item, | 
					
						
							|  |  |  |     'process' : Processes_Suite.process, | 
					
						
							|  |  |  |     'window' : Standard_Suite.window, | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2003-03-30 22:41:53 +00:00
										 |  |  | folder_action._superclassnames = ['item'] | 
					
						
							|  |  |  | folder_action._privpropdict = { | 
					
						
							| 
									
										
										
										
											2003-04-12 22:27:11 +00:00
										 |  |  |     '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, | 
					
						
							|  |  |  |     'name' : _Prop_name, | 
					
						
							|  |  |  |     'path' : _Prop_path, | 
					
						
							|  |  |  |     'properties' : _Prop_properties, | 
					
						
							|  |  |  |     'volume' : _Prop_volume, | 
					
						
							| 
									
										
										
										
											2003-03-30 22:41:53 +00:00
										 |  |  | } | 
					
						
							|  |  |  | folder_action._privelemdict = { | 
					
						
							| 
									
										
										
										
											2003-04-12 22:27:11 +00:00
										 |  |  |     'script' : script, | 
					
						
							| 
									
										
										
										
											2003-03-30 22:41:53 +00:00
										 |  |  | } | 
					
						
							|  |  |  | script._superclassnames = ['item'] | 
					
						
							|  |  |  | script._privpropdict = { | 
					
						
							| 
									
										
										
										
											2003-04-12 22:27:11 +00:00
										 |  |  |     'POSIX_path' : _Prop_POSIX_path, | 
					
						
							|  |  |  |     '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, | 
					
						
							|  |  |  |     'name' : _Prop_name, | 
					
						
							|  |  |  |     'path' : _Prop_path, | 
					
						
							|  |  |  |     'properties' : _Prop_properties, | 
					
						
							| 
									
										
										
										
											2003-03-30 22:41:53 +00:00
										 |  |  | } | 
					
						
							|  |  |  | script._privelemdict = { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | _Enum_actn = { | 
					
						
							| 
									
										
										
										
											2003-04-12 22:27:11 +00:00
										 |  |  |     'items_added' : 'fget',	# items added | 
					
						
							|  |  |  |     'items_removed' : 'flos',	# items removed | 
					
						
							|  |  |  |     'window_closed' : 'fclo',	# window closed | 
					
						
							|  |  |  |     'window_moved' : 'fsiz',	# window moved | 
					
						
							|  |  |  |     'window_opened' : 'fopn',	# window opened | 
					
						
							| 
									
										
										
										
											2003-03-30 22:41:53 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # Indices of types declared in this module | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | _classdeclarations = { | 
					
						
							| 
									
										
										
										
											2003-06-13 14:31:19 +00:00
										 |  |  |     'capp' : application, | 
					
						
							| 
									
										
										
										
											2003-04-12 22:27:11 +00:00
										 |  |  |     'foac' : folder_action, | 
					
						
							|  |  |  |     'scpt' : script, | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | _propdeclarations = { | 
					
						
							|  |  |  |     'c@#^' : _Prop__3c_Inheritance_3e_, | 
					
						
							| 
									
										
										
										
											2003-06-13 14:31:19 +00:00
										 |  |  |     'faen' : _Prop_folder_actions_enabled, | 
					
						
							| 
									
										
										
										
											2003-04-12 22:27:11 +00:00
										 |  |  |     'pALL' : _Prop_properties, | 
					
						
							|  |  |  |     'pnam' : _Prop_name, | 
					
						
							|  |  |  |     'posx' : _Prop_POSIX_path, | 
					
						
							|  |  |  |     'ppth' : _Prop_path, | 
					
						
							|  |  |  |     'volu' : _Prop_volume, | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | _compdeclarations = { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | _enumdeclarations = { | 
					
						
							|  |  |  |     'actn' : _Enum_actn, | 
					
						
							| 
									
										
										
										
											2003-03-30 22:41:53 +00:00
										 |  |  | } |