Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7e156a7

Browse files
committed
Added missing get() method
1 parent bdd0747 commit 7e156a7

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

Mac/Lib/toolbox/aetools.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,33 @@ def send(self, code, subcode, parameters = {}, attributes = {}):
154154
"""Send an appleevent given code/subcode/pars/attrs and unpack the reply"""
155155
return self.sendevent(self.newevent(code, subcode, parameters, attributes))
156156

157+
#
158+
# The following events are somehow "standard" and don't seem to appear in any
159+
# suite...
160+
#
157161
def activate(self):
158162
"""Send 'activate' command"""
159163
self.send('misc', 'actv')
164+
165+
def get(self, _object, _attributes={}):
166+
"""get: get data from an object
167+
Required argument: the object
168+
Keyword argument _attributes: AppleEvent attribute dictionary
169+
Returns: the data
170+
"""
171+
_code = 'core'
172+
_subcode = 'getd'
173+
174+
_arguments = {'----':_object}
175+
176+
177+
_reply, _arguments, _attributes = self.send(_code, _subcode,
178+
_arguments, _attributes)
179+
if _arguments.has_key('errn'):
180+
raise MacOS.Error, decodeerror(_arguments)
181+
182+
if _arguments.has_key('----'):
183+
return _arguments['----']
160184

161185

162186
# Test program

0 commit comments

Comments
 (0)