Re: Parameters with run handler
Re: Parameters with run handler
- Subject: Re: Parameters with run handler
- From: "Donald S. Hall" <email@hidden>
- Date: Wed, 09 Jan 2002 00:17:41 -0700
Paul,
The correct sytnax is:
run script <variable or reference> [with parameters parameterList] [in
scriptingComponent]
The 'in' parameter is only used if you want to use something like QuicKeys
or someother alternate scripting language.
e.g.
run script myScript with parameters {2, 6.5}
where myScript is a file or alias reference to your script.
in myScript:
on run {p1, p2}
-- whatever
end run
You can't directly run a parameterized script from the Script Editor - it
doesn't know what to do with the parameters.
HTH,
Don
p.s. See Appendix B of the Script Timer User's Manual.
>
Am I imagining it, or have I read here that it is possible to include a
>
parameter in list braces for a run handler, and to call it from another
>
script using the parameter, something like this:
>
>
tell application "Applet"
>
launch
>
run {someParameter}
>
end tell
>
>
or
>
>
set f to load script file aCompiledScriptsPath
>
tell f to run {someParameter}
>
>
where the script application or compiled script in question has a run
>
handler:
>
>
on run {someParameter}
>
--script
>
end run
>
>
I can find nothing about this in the ASLG or O'Reilly's Nutshell, and it
>
doesn't seem to work in OS X. So I must be imagining it. But I'd swear I
>
read about it here.
>
>
In the case of the compiled script or non-stay-open applet, it doesn't
>
matter: you can just change a property when you load the script, and store
>
it if necessary, or not. But a stay-open applet is "busy" if open, so you
>
can't store a property change. Being able to use a parameter would be a
>
great help.
>
>
--
>
Paul Berkowitz
--
Donald S. Hall, Ph.D.
Apps & More Software Design, Inc.
http://www.theboss.net/appsmore
email@hidden