Re: passing values from one script into a second script ?
Re: passing values from one script into a second script ?
- Subject: Re: passing values from one script into a second script ?
- From: Sun Real <email@hidden>
- Date: Wed, 1 Aug 2001 18:12:21 +1000
Bill Christens-Barry's message of 1/8/01 11:31 AM contained:
>
I'm still trying to resolve this. I need to use one script to run a
>
second, compiled script, with the first script passing a set of
>
values (strings, actually) to the script that it calls. Can anyone
>
provide a simple example of how to do this?
What about the 'run script' command? Save this as a compiled script:
-- scriptReceiver --
on run pramList
repeat with n from 1 to length of pramList
display dialog "Dialog #" & item n of pramList with icon (n - 1)
end repeat
end run
-- /scriptReceiver --
...and run it using this:
run script "Path:To:scriptReceiver" with parameters {1, 2, 3}
--> {button returned:"OK"}
I find this really useful for 'engine' type scripts. It is documented in
the old "Scripting Additions Guide" pdf (copied below) and is also in the
Standard Additions dictionary.
-- -- -- -- -- -- -- -- -- -- -- --
SYNTAX
run script referenceOrString ,
[ with parameters listOfParameters ] ,
[ in scriptingComponent ]
PARAMETERS
referenceOrString
A reference of the form file nameString or alias nameString
that specifies a script file, or a string that consists of a valid
script.
Class: Reference or string
listOfParameters
A list of parameters to be passed to the Run handler of the target.
Class: List
scriptingComponent
The name of the scripting component to use when running
the script.
Class: String
RESULT
Value returned by script that is run.
-- -- -- -- -- -- -- -- -- -- -- --
Cheers,
Richard Morton
-- Great Lies of the Music Business: "We'll let you know"