Re: [Pythonmac-SIG] Python app with aemreceive is not scriptable

2010-01-10 Thread Kevin Walzer
On 1/10/10 3:08 PM, Kevin Walzer wrote: What's the best way to structure the command so that it can be seen from AppleScript, i.e. run in the proper scope and not return an error? Never mind about the scope question--I found that simply adding the aemreceive bits and the custom function insi

Re: [Pythonmac-SIG] Python app with aemreceive is not scriptable

2010-01-10 Thread Kevin Walzer
On 1/6/10 4:58 AM, has wrote: Though personally I'd be looking to add a proper AE API, even if only procedural, so that users can't just run arbitrary code. But that's your decision, not mine. Following has's advice here, I'm trying to implement a basic API (set of Python commands/functio

Re: [Pythonmac-SIG] Python app with aemreceive is not scriptable

2010-01-06 Thread has
Kevin Walzer wrote: > It appears that Tcl and Python differ in some respects in code execution. > Python doesn't appear to return a value from code that is passed to the > "exec" statement. exec evaluates statements, and Python statements don't return values. You'd need to pass global/local di

Re: [Pythonmac-SIG] Python app with aemreceive is not scriptable

2010-01-05 Thread Kevin Walzer
On 1/5/10 11:41 AM, has wrote: If I understand you, Tk implements a 'do script' handler that executes arbitrary Tcl scripts (right...no potential security issues there, then) and you are installing your own 'do script' handler as well. Yes, that's basically it. If that's the case, make su

Re: [Pythonmac-SIG] Python app with aemreceive is not scriptable

2010-01-05 Thread has
Kevin Walzer wrote: > Now my app responds to Apple Events and doesn't complain about a corrupted > dictionary. However, I'm having some additional difficulty. It appears that > Apple Events are bypassing the bundled Python and are going straight to the > Tk framework instead. Tk/Aqua has pretty

Re: [Pythonmac-SIG] Python app with aemreceive is not scriptable

2010-01-05 Thread Kevin Walzer
On 1/4/10 11:24 PM, Kevin Walzer wrote: On 1/4/10 8:18 AM, Kevin Walzer wrote: On 1/4/10 6:37 AM, has wrote: This is very weird, and I have no clue how to untangle it. My app won't respond to Apple Events at all without a valid sdef file in the bundle's Resources directory. However, if the s

Re: [Pythonmac-SIG] Python app with aemreceive is not scriptable

2010-01-04 Thread Kevin Walzer
On 1/4/10 8:18 AM, Kevin Walzer wrote: On 1/4/10 6:37 AM, has wrote: Sounds like you forgot to add an OSAScriptingDefinition entry containing the sdef's filename to your info.plist. Also, bear in mind that sdef-only apps won't work in 10.4 or earlier; if that's a concern then you'll need to pr

Re: [Pythonmac-SIG] Python app with aemreceive is not scriptable

2010-01-04 Thread Kevin Walzer
On 1/4/10 6:37 AM, has wrote: Sounds like you forgot to add an OSAScriptingDefinition entry containing the sdef's filename to your info.plist. Also, bear in mind that sdef-only apps won't work in 10.4 or earlier; if that's a concern then you'll need to provide an aete as well. That worked,

Re: [Pythonmac-SIG] Python app with aemreceive is not scriptable

2010-01-04 Thread has
Kevin Walzer wrote: > I'm trying to use aemreceive to allow one of my Python applications to > receive simple Apple Events. > [...] > The idea here is to allow the application to execute Python code in response > to an Apple Event. > > I have included a simple SDEF file in the app bundle that a

[Pythonmac-SIG] Python app with aemreceive is not scriptable

2010-01-03 Thread Kevin Walzer
Hi all: I'm trying to use aemreceive to allow one of my Python applications to receive simple Apple Events. Here's the relevant code that installs the event handler: from aemreceive import * def doScript(script): exec script installeventhandler( doScript, 'miscdosc',