Re: run script with parameters
Re: run script with parameters
- Subject: Re: run script with parameters
- From: deivy petrescu <email@hidden>
- Date: Tue, 3 Oct 2006 13:21:07 -0400
On Oct 3, 2006, at 11:54, Philip Aker wrote:
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
Well, I did not get the text either. I got the same thing on a ppc
mac with AS 1.10.7
-->{«script»} on the result pane
and
tell current application
run script "on run paramList
return paramList
end run" with parameters «script»
{«script»}
end tell
on the Event log pane.
_______________________________________________
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