Re: Scripter (The Program)
Re: Scripter (The Program)
- Subject: Re: Scripter (The Program)
- From: Richard 23 <email@hidden>
- Date: Thu, 9 Nov 2000 00:22:00 -0800
>
Being a huge fan of Scripter, I have to put in a plug for the full
>
version.
Ok. Since several people are extolling the virtues of Scripter perhaps
someone who has the latest version could test something for me. I'd
like to know if the following legal techniques which work in every other
script editor still fail to compile in Scripter.
Version 2.2 is unable to handle the following snippet which contains
two tests:
-- ---------------------------------------------------------
-- top level script object. Scripter gives me a bogus error
-- ---------------------------------------------------------
-- "The run handler was specified more than once or there
-- were top-level commands in addition to the run handler."
-- ---------------------------------------------------------
script ScriptObj
beep
end
-- ---------------------------------------------------------
-- handler reassingment/redefinition
-- ---------------------------------------------------------
-- a useful technique for executing scripts generated on the
-- fly in the top-level but will not be allowed to compile
-- in Scripter 2.2.
-- ---------------------------------------------------------
-- "Number of parameters on call do not match number on
-- declaration."
-- ---------------------------------------------------------
on run
set my TestHandler to run script "TestHandler
on TestHandler(theName)
display dialog \"Hello, \" & theName
end"
TestHandler("R23")
end run
on TestHandler()
end TestHandler
-- ---------------------------------------------------------
-- handler reassingment/redefinition revisited
-- ---------------------------------------------------------
-- "Number of parameters on call do not match number
-- on declaration."
-- ---------------------------------------------------------
-- The following works until the last line is uncommented.
-- Then an error occurs, preventing compilation.
-- ---------------------------------------------------------
on run
set theObj to run script "me
on f(theName)
return \"Hello, \" & theName
end"
tell theObj to f("R23")
set my f to theObj's f
-- f("32R")
end run
on f()
end f
*** This won't compile...why? ***
-- ---------------------------------------------------------
-- handler reassingment/redefinition: the last gasp
-- ---------------------------------------------------------
-- compiling the script out of sight of Scripter (wrapping
-- it in quotes and performing a "run script" to compile it.
-- ---------------------------------------------------------
set theObj to run script "
script
on run
set theObj to run script \"me
on f(theName)
\\\"Hello, \\\" & theName
end f\"
tell theObj to f(\"R23\")
set my f to theObj's f
f(\"23R\")
end run
on f()
end f
end script"
set theValue to run theObj
--> "Hello, 23R"
tell theObj to f("this")
--> "Hello, this"
Sort of makes the method a little inconvenient though!
If these work in the new version I would like to know.
Maybe I could then re-evaluate whether I'd like to upgrade.
Thanks,
R23