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