| 1 | n/a | """Suite Folder Actions Suite: Terms and Events for controlling Folder Actions |
|---|
| 2 | n/a | Level 1, version 1 |
|---|
| 3 | n/a | |
|---|
| 4 | n/a | Generated from /System/Library/CoreServices/System Events.app |
|---|
| 5 | n/a | AETE/AEUT resource version 1/0, language 0, script 0 |
|---|
| 6 | n/a | """ |
|---|
| 7 | n/a | |
|---|
| 8 | n/a | import aetools |
|---|
| 9 | n/a | import MacOS |
|---|
| 10 | n/a | |
|---|
| 11 | n/a | _code = 'faco' |
|---|
| 12 | n/a | |
|---|
| 13 | n/a | class Folder_Actions_Suite_Events: |
|---|
| 14 | n/a | |
|---|
| 15 | n/a | _argmap_attach_action_to = { |
|---|
| 16 | n/a | 'using' : 'faal', |
|---|
| 17 | n/a | } |
|---|
| 18 | n/a | |
|---|
| 19 | n/a | def attach_action_to(self, _object, _attributes={}, **_arguments): |
|---|
| 20 | n/a | """attach action to: Attach an action to a folder |
|---|
| 21 | n/a | Required argument: the object for the command |
|---|
| 22 | n/a | Keyword argument using: a file containing the script to attach |
|---|
| 23 | n/a | Keyword argument _attributes: AppleEvent attribute dictionary |
|---|
| 24 | n/a | Returns: the reply for the command |
|---|
| 25 | n/a | """ |
|---|
| 26 | n/a | _code = 'faco' |
|---|
| 27 | n/a | _subcode = 'atfa' |
|---|
| 28 | n/a | |
|---|
| 29 | n/a | aetools.keysubst(_arguments, self._argmap_attach_action_to) |
|---|
| 30 | n/a | _arguments['----'] = _object |
|---|
| 31 | n/a | |
|---|
| 32 | n/a | |
|---|
| 33 | n/a | _reply, _arguments, _attributes = self.send(_code, _subcode, |
|---|
| 34 | n/a | _arguments, _attributes) |
|---|
| 35 | n/a | if _arguments.get('errn', 0): |
|---|
| 36 | n/a | raise aetools.Error, aetools.decodeerror(_arguments) |
|---|
| 37 | n/a | # XXXX Optionally decode result |
|---|
| 38 | n/a | if _arguments.has_key('----'): |
|---|
| 39 | n/a | return _arguments['----'] |
|---|
| 40 | n/a | |
|---|
| 41 | n/a | def attached_scripts(self, _object, _attributes={}, **_arguments): |
|---|
| 42 | n/a | """attached scripts: List the actions attached to a folder |
|---|
| 43 | n/a | Required argument: the object for the command |
|---|
| 44 | n/a | Keyword argument _attributes: AppleEvent attribute dictionary |
|---|
| 45 | n/a | Returns: the reply for the command |
|---|
| 46 | n/a | """ |
|---|
| 47 | n/a | _code = 'faco' |
|---|
| 48 | n/a | _subcode = 'lact' |
|---|
| 49 | n/a | |
|---|
| 50 | n/a | if _arguments: raise TypeError, 'No optional args expected' |
|---|
| 51 | n/a | _arguments['----'] = _object |
|---|
| 52 | n/a | |
|---|
| 53 | n/a | |
|---|
| 54 | n/a | _reply, _arguments, _attributes = self.send(_code, _subcode, |
|---|
| 55 | n/a | _arguments, _attributes) |
|---|
| 56 | n/a | if _arguments.get('errn', 0): |
|---|
| 57 | n/a | raise aetools.Error, aetools.decodeerror(_arguments) |
|---|
| 58 | n/a | # XXXX Optionally decode result |
|---|
| 59 | n/a | if _arguments.has_key('----'): |
|---|
| 60 | n/a | return _arguments['----'] |
|---|
| 61 | n/a | |
|---|
| 62 | n/a | _argmap_do_folder_action = { |
|---|
| 63 | n/a | 'with_window_size' : 'fnsz', |
|---|
| 64 | n/a | 'with_item_list' : 'flst', |
|---|
| 65 | n/a | 'folder_action_code' : 'actn', |
|---|
| 66 | n/a | } |
|---|
| 67 | n/a | |
|---|
| 68 | n/a | def do_folder_action(self, _object, _attributes={}, **_arguments): |
|---|
| 69 | n/a | """do folder action: Event the Finder sends to the Folder Actions FBA |
|---|
| 70 | n/a | Required argument: the object for the command |
|---|
| 71 | n/a | Keyword argument with_window_size: the new window size for the folder action message to process |
|---|
| 72 | n/a | Keyword argument with_item_list: a list of items for the folder action message to process |
|---|
| 73 | n/a | Keyword argument folder_action_code: the folder action message to process |
|---|
| 74 | n/a | Keyword argument _attributes: AppleEvent attribute dictionary |
|---|
| 75 | n/a | Returns: the reply for the command |
|---|
| 76 | n/a | """ |
|---|
| 77 | n/a | _code = 'faco' |
|---|
| 78 | n/a | _subcode = 'fola' |
|---|
| 79 | n/a | |
|---|
| 80 | n/a | aetools.keysubst(_arguments, self._argmap_do_folder_action) |
|---|
| 81 | n/a | _arguments['----'] = _object |
|---|
| 82 | n/a | |
|---|
| 83 | n/a | aetools.enumsubst(_arguments, 'actn', _Enum_actn) |
|---|
| 84 | n/a | |
|---|
| 85 | n/a | _reply, _arguments, _attributes = self.send(_code, _subcode, |
|---|
| 86 | n/a | _arguments, _attributes) |
|---|
| 87 | n/a | if _arguments.get('errn', 0): |
|---|
| 88 | n/a | raise aetools.Error, aetools.decodeerror(_arguments) |
|---|
| 89 | n/a | # XXXX Optionally decode result |
|---|
| 90 | n/a | if _arguments.has_key('----'): |
|---|
| 91 | n/a | return _arguments['----'] |
|---|
| 92 | n/a | |
|---|
| 93 | n/a | _argmap_edit_action_of = { |
|---|
| 94 | n/a | 'using_action_name' : 'snam', |
|---|
| 95 | n/a | 'using_action_number' : 'indx', |
|---|
| 96 | n/a | } |
|---|
| 97 | n/a | |
|---|
| 98 | n/a | def edit_action_of(self, _object, _attributes={}, **_arguments): |
|---|
| 99 | n/a | """edit action of: Edit as action of a folder |
|---|
| 100 | n/a | Required argument: the object for the command |
|---|
| 101 | n/a | Keyword argument using_action_name: ...or the name of the action to edit |
|---|
| 102 | n/a | Keyword argument using_action_number: the index number of the action to edit... |
|---|
| 103 | n/a | Keyword argument _attributes: AppleEvent attribute dictionary |
|---|
| 104 | n/a | Returns: the reply for the command |
|---|
| 105 | n/a | """ |
|---|
| 106 | n/a | _code = 'faco' |
|---|
| 107 | n/a | _subcode = 'edfa' |
|---|
| 108 | n/a | |
|---|
| 109 | n/a | aetools.keysubst(_arguments, self._argmap_edit_action_of) |
|---|
| 110 | n/a | _arguments['----'] = _object |
|---|
| 111 | n/a | |
|---|
| 112 | n/a | |
|---|
| 113 | n/a | _reply, _arguments, _attributes = self.send(_code, _subcode, |
|---|
| 114 | n/a | _arguments, _attributes) |
|---|
| 115 | n/a | if _arguments.get('errn', 0): |
|---|
| 116 | n/a | raise aetools.Error, aetools.decodeerror(_arguments) |
|---|
| 117 | n/a | # XXXX Optionally decode result |
|---|
| 118 | n/a | if _arguments.has_key('----'): |
|---|
| 119 | n/a | return _arguments['----'] |
|---|
| 120 | n/a | |
|---|
| 121 | n/a | _argmap_remove_action_from = { |
|---|
| 122 | n/a | 'using_action_name' : 'snam', |
|---|
| 123 | n/a | 'using_action_number' : 'indx', |
|---|
| 124 | n/a | } |
|---|
| 125 | n/a | |
|---|
| 126 | n/a | def remove_action_from(self, _object, _attributes={}, **_arguments): |
|---|
| 127 | n/a | """remove action from: Remove a folder action from a folder |
|---|
| 128 | n/a | Required argument: the object for the command |
|---|
| 129 | n/a | Keyword argument using_action_name: ...or the name of the action to remove |
|---|
| 130 | n/a | Keyword argument using_action_number: the index number of the action to remove... |
|---|
| 131 | n/a | Keyword argument _attributes: AppleEvent attribute dictionary |
|---|
| 132 | n/a | Returns: the reply for the command |
|---|
| 133 | n/a | """ |
|---|
| 134 | n/a | _code = 'faco' |
|---|
| 135 | n/a | _subcode = 'rmfa' |
|---|
| 136 | n/a | |
|---|
| 137 | n/a | aetools.keysubst(_arguments, self._argmap_remove_action_from) |
|---|
| 138 | n/a | _arguments['----'] = _object |
|---|
| 139 | n/a | |
|---|
| 140 | n/a | |
|---|
| 141 | n/a | _reply, _arguments, _attributes = self.send(_code, _subcode, |
|---|
| 142 | n/a | _arguments, _attributes) |
|---|
| 143 | n/a | if _arguments.get('errn', 0): |
|---|
| 144 | n/a | raise aetools.Error, aetools.decodeerror(_arguments) |
|---|
| 145 | n/a | # XXXX Optionally decode result |
|---|
| 146 | n/a | if _arguments.has_key('----'): |
|---|
| 147 | n/a | return _arguments['----'] |
|---|
| 148 | n/a | |
|---|
| 149 | n/a | |
|---|
| 150 | n/a | class application(aetools.ComponentItem): |
|---|
| 151 | n/a | """application - The Folder Actions Suite host program """ |
|---|
| 152 | n/a | want = 'capp' |
|---|
| 153 | n/a | class _Prop__3c_Inheritance_3e_(aetools.NProperty): |
|---|
| 154 | n/a | """<Inheritance> - All of the properties of the superclass. """ |
|---|
| 155 | n/a | which = 'c@#^' |
|---|
| 156 | n/a | want = 'capp' |
|---|
| 157 | n/a | _3c_Inheritance_3e_ = _Prop__3c_Inheritance_3e_() |
|---|
| 158 | n/a | class _Prop_folder_actions_enabled(aetools.NProperty): |
|---|
| 159 | n/a | """folder actions enabled - Are Folder Actions currently being processed? """ |
|---|
| 160 | n/a | which = 'faen' |
|---|
| 161 | n/a | want = 'bool' |
|---|
| 162 | n/a | folder_actions_enabled = _Prop_folder_actions_enabled() |
|---|
| 163 | n/a | class _Prop_properties(aetools.NProperty): |
|---|
| 164 | n/a | """properties - every property of the Folder Actions Suite host program """ |
|---|
| 165 | n/a | which = 'pALL' |
|---|
| 166 | n/a | want = '****' |
|---|
| 167 | n/a | properties = _Prop_properties() |
|---|
| 168 | n/a | # element 'cdis' as ['name', 'indx', 'rele', 'rang', 'test'] |
|---|
| 169 | n/a | # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] |
|---|
| 170 | n/a | # element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] |
|---|
| 171 | n/a | # element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID '] |
|---|
| 172 | n/a | # element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] |
|---|
| 173 | n/a | # element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] |
|---|
| 174 | n/a | # element 'foac' as ['name', 'indx', 'rele', 'rang', 'test'] |
|---|
| 175 | n/a | # element 'logi' as ['name', 'indx', 'rele', 'rang', 'test'] |
|---|
| 176 | n/a | # element 'pcap' as ['name', 'indx', 'rele', 'rang', 'test'] |
|---|
| 177 | n/a | # element 'pcda' as ['name', 'indx', 'rele', 'rang', 'test'] |
|---|
| 178 | n/a | # element 'prcs' as ['name', 'indx', 'rele', 'rang', 'test'] |
|---|
| 179 | n/a | |
|---|
| 180 | n/a | applications = application |
|---|
| 181 | n/a | |
|---|
| 182 | n/a | class folder_action(aetools.ComponentItem): |
|---|
| 183 | n/a | """folder action - An action attached to a folder in the file system """ |
|---|
| 184 | n/a | want = 'foac' |
|---|
| 185 | n/a | class _Prop_name(aetools.NProperty): |
|---|
| 186 | n/a | """name - the name of the folder action, which is also the name of the folder """ |
|---|
| 187 | n/a | which = 'pnam' |
|---|
| 188 | n/a | want = 'utxt' |
|---|
| 189 | n/a | class _Prop_path(aetools.NProperty): |
|---|
| 190 | n/a | """path - the path to the folder to which the folder action applies """ |
|---|
| 191 | n/a | which = 'ppth' |
|---|
| 192 | n/a | want = '****' |
|---|
| 193 | n/a | class _Prop_volume(aetools.NProperty): |
|---|
| 194 | n/a | """volume - the volume on which the folder action resides """ |
|---|
| 195 | n/a | which = 'volu' |
|---|
| 196 | n/a | want = 'utxt' |
|---|
| 197 | n/a | # element 'scpt' as ['name', 'indx', 'rele', 'rang', 'test'] |
|---|
| 198 | n/a | |
|---|
| 199 | n/a | folder_actions = folder_action |
|---|
| 200 | n/a | |
|---|
| 201 | n/a | class script(aetools.ComponentItem): |
|---|
| 202 | n/a | """script - A script invoked by a folder action """ |
|---|
| 203 | n/a | want = 'scpt' |
|---|
| 204 | n/a | class _Prop_POSIX_path(aetools.NProperty): |
|---|
| 205 | n/a | """POSIX path - the POSIX file system path of the disk """ |
|---|
| 206 | n/a | which = 'posx' |
|---|
| 207 | n/a | want = 'utxt' |
|---|
| 208 | n/a | |
|---|
| 209 | n/a | scripts = script |
|---|
| 210 | n/a | application._superclassnames = [] |
|---|
| 211 | n/a | import Disk_Folder_File_Suite |
|---|
| 212 | n/a | import Standard_Suite |
|---|
| 213 | n/a | import Login_Items_Suite |
|---|
| 214 | n/a | import Processes_Suite |
|---|
| 215 | n/a | application._privpropdict = { |
|---|
| 216 | n/a | '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, |
|---|
| 217 | n/a | 'folder_actions_enabled' : _Prop_folder_actions_enabled, |
|---|
| 218 | n/a | 'properties' : _Prop_properties, |
|---|
| 219 | n/a | } |
|---|
| 220 | n/a | application._privelemdict = { |
|---|
| 221 | n/a | 'application_process' : Processes_Suite.application_process, |
|---|
| 222 | n/a | 'desk_accessory_process' : Processes_Suite.desk_accessory_process, |
|---|
| 223 | n/a | 'disk' : Disk_Folder_File_Suite.disk, |
|---|
| 224 | n/a | 'document' : Standard_Suite.document, |
|---|
| 225 | n/a | 'file' : Disk_Folder_File_Suite.file, |
|---|
| 226 | n/a | 'folder' : Disk_Folder_File_Suite.folder, |
|---|
| 227 | n/a | 'folder_action' : folder_action, |
|---|
| 228 | n/a | 'item' : Disk_Folder_File_Suite.item, |
|---|
| 229 | n/a | 'login_item' : Login_Items_Suite.login_item, |
|---|
| 230 | n/a | 'process' : Processes_Suite.process, |
|---|
| 231 | n/a | 'window' : Standard_Suite.window, |
|---|
| 232 | n/a | } |
|---|
| 233 | n/a | folder_action._superclassnames = ['item'] |
|---|
| 234 | n/a | folder_action._privpropdict = { |
|---|
| 235 | n/a | '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, |
|---|
| 236 | n/a | 'name' : _Prop_name, |
|---|
| 237 | n/a | 'path' : _Prop_path, |
|---|
| 238 | n/a | 'properties' : _Prop_properties, |
|---|
| 239 | n/a | 'volume' : _Prop_volume, |
|---|
| 240 | n/a | } |
|---|
| 241 | n/a | folder_action._privelemdict = { |
|---|
| 242 | n/a | 'script' : script, |
|---|
| 243 | n/a | } |
|---|
| 244 | n/a | script._superclassnames = ['item'] |
|---|
| 245 | n/a | script._privpropdict = { |
|---|
| 246 | n/a | 'POSIX_path' : _Prop_POSIX_path, |
|---|
| 247 | n/a | '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, |
|---|
| 248 | n/a | 'name' : _Prop_name, |
|---|
| 249 | n/a | 'path' : _Prop_path, |
|---|
| 250 | n/a | 'properties' : _Prop_properties, |
|---|
| 251 | n/a | } |
|---|
| 252 | n/a | script._privelemdict = { |
|---|
| 253 | n/a | } |
|---|
| 254 | n/a | _Enum_actn = { |
|---|
| 255 | n/a | 'items_added' : 'fget', # items added |
|---|
| 256 | n/a | 'items_removed' : 'flos', # items removed |
|---|
| 257 | n/a | 'window_closed' : 'fclo', # window closed |
|---|
| 258 | n/a | 'window_moved' : 'fsiz', # window moved |
|---|
| 259 | n/a | 'window_opened' : 'fopn', # window opened |
|---|
| 260 | n/a | } |
|---|
| 261 | n/a | |
|---|
| 262 | n/a | |
|---|
| 263 | n/a | # |
|---|
| 264 | n/a | # Indices of types declared in this module |
|---|
| 265 | n/a | # |
|---|
| 266 | n/a | _classdeclarations = { |
|---|
| 267 | n/a | 'capp' : application, |
|---|
| 268 | n/a | 'foac' : folder_action, |
|---|
| 269 | n/a | 'scpt' : script, |
|---|
| 270 | n/a | } |
|---|
| 271 | n/a | |
|---|
| 272 | n/a | _propdeclarations = { |
|---|
| 273 | n/a | 'c@#^' : _Prop__3c_Inheritance_3e_, |
|---|
| 274 | n/a | 'faen' : _Prop_folder_actions_enabled, |
|---|
| 275 | n/a | 'pALL' : _Prop_properties, |
|---|
| 276 | n/a | 'pnam' : _Prop_name, |
|---|
| 277 | n/a | 'posx' : _Prop_POSIX_path, |
|---|
| 278 | n/a | 'ppth' : _Prop_path, |
|---|
| 279 | n/a | 'volu' : _Prop_volume, |
|---|
| 280 | n/a | } |
|---|
| 281 | n/a | |
|---|
| 282 | n/a | _compdeclarations = { |
|---|
| 283 | n/a | } |
|---|
| 284 | n/a | |
|---|
| 285 | n/a | _enumdeclarations = { |
|---|
| 286 | n/a | 'actn' : _Enum_actn, |
|---|
| 287 | n/a | } |
|---|