Re: run script with parameters
Re: run script with parameters
- Subject: Re: run script with parameters
- From: Philip Aker <email@hidden>
- Date: Tue, 03 Oct 2006 08:54:12 -0700
On 2006-10-03, at 07:16:19, Nigel Garvey wrote:
I'm just wondering if this is a bug or a feature. This test script ...
set params to {1, {a:1, b:2}, me}
run script "on run paramList
return paramList
end run" with parameters params
... returns {1, {a:1, b:2}, «script»} as expected.
If params isn't a list, though - say it's just 1 or "Fred" - the
result is still {1} or {"Fred"}, suggesting that some process tries
to ensure the text script receives a list parameter. With AS 1.8.3
and 1.9.1, the result is similar when params is a record: the
script returns a record in a list. With AS 1.10.7, the result with
a record is simply «script», whose properties are those of Script
Editor.
But the point of this query concerns when params is a script or a
script object. The result in this case, with AS 1.9.1 or 1.10.7, is
a list containing the decompiled text of the script or script object.
set params to me
run script "on run paramList
return paramList
end run" with parameters params
(* --> {"set params to me
run script \"on run paramList
return paramList
end run\" with parameters params"} *)
This works however the main script's run (unless it's a run-only
application) and can be very useful - but is it supposed to happen?
Nigel,
I'm not getting the text (OS X 10.4.8/Intel). I have no earlier
versions to test on but could try the same on ppc if no one else
chimes in.
Seems to me (in spite of slack form example I've posted recently to
this list), the proper form for args to run script is to enclose them
in braces:
set params to me
run script "on run {theParams}" & return & "return theParams" &
return & "end run" with parameters {params}
--> «script»
Philip Aker
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden