Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Pythonmac-SIG] creating a dictionary for an applescript app?



On 22 Jun 2007, at 02:01, tom wible wrote:

tried your applet code:

>>> playRec = praem.Applet.initwithname('playRec')
>>> recList = playRec.callsub('listRecDict')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "praem.py", line 9, in callsub
self.event('ascrpsbr', {'snam': name, '----': args}).send()
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/site-packages/aeosa/aem/send/send.py", line 101, in send
raise CommandError(err[0], err.args[1:] and err[1] or '', None)
aem.send.send.CommandError: CommandError -1708: the AppleEvent was not handled by any handler


but i do have a handler:


on listRecDict() set tdl to {} set n to 0 repeat with rec in recList set n to n + 1 set end of tdl to rec's toDict(n) end repeat return tdl end listRecDict

is there something else that has to be done to get the handler recognized?
thanx

My bad, I forgot to lowercase the subroutine names in my Python script. Internally, AppleScript lowercases subroutine names unless they're written within pipes, e.g. 'FooBar' should be called as 'foobar', '|FooBar|' as 'FooBar'. So the correct code should be:


playRec = Applet.initwithname('playRec')
playRec.callsub('initreclist', False)
recList = playRec.callsub('listrecdict')

HTH

has
--
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org
http://appscript.sourceforge.net/objc-appscript.html

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >creating a dictionary for an applescript app? (From: tom wible <email@hidden>)
 >Re: creating a dictionary for an applescript app? (From: has <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.