On Jan 10, 2013, at 10:06 AM, Luther Fuller wrote: I can run an AppleScript application with the command:
run application pathToAppl
but I need to pass parameters to the run handler. The run handler would have to look something like:
on run parameterList -- do something with parameterList end run
I don't think this can be done. At least I've tried and can't get anything to work.
Is there any way to pass parameters to a run handler? If so, how is it done?
Hi Luther,
Here's an indirect method to pass parameters to a run handler. It's a bit convoluted, but works (in Lion, at least):
<BEGIN APPLICATION> property gParamList : missing value on run if gParamList is not missing value then -- do something with gParamList display dialog (item 1 of gParamList) end if end run on passToRunHandler(paramList) set gParamList to paramList run end passToRunHandler <END APPLICATION>
<BEGIN CALLING SCRIPT> tell application "MacHD:Users:stanc:Desktop:RunTest.app" launch passToRunHandler({"Hello"}) end tell <END CALLING SCRIPT>
As far as I can tell, the code can't be simplified any further.
Out of curiosity, why not put your code into a regular handler and call that, rather than the run handler? That's basically what the above method does.
HTH, Stan C.
|