Re:Coerce String to Handler? - SOLVED???
Re:Coerce String to Handler? - SOLVED???
- Subject: Re:Coerce String to Handler? - SOLVED???
- From: Ehsan Saffari <email@hidden>
- Date: Wed, 18 Apr 2001 08:08:10 -0600
On 18 Apr 2001 01:03:19, "Neal A. Crocker" <email@hidden>
wrote:
<major snip>
>
Second soiution, for handler of script applications. The expample
>
below contains the body of a script application called "ScriptApp"
>
and a compiled script which, when executed, calls on ScriptApp to
>
execute its "foo" handler:
>
>
>
-- script appliction "ScriptApp" starts here
>
on foo(arg)
>
return arg
>
end foo
>
-- script appliction "ScriptApp" end here
>
>
>
-- script which calls on script appliction "ScriptApp" starts here
>
tell application "ScriptApp"
>
launch
>
--<<event ascrpsbr>> {4} given <<class snam>>:"foo" --
>
equivalent to subroutine call "foo(4)"
>
Call*subroutine {4} given <<class snam>>:"foo" -- this line
>
will not compile. must delete and uncomment line above
>
end tell
>
-- script which calls on script appliction "scriptapp" ends here
Thanks to Neal and all others who responded. But...
What I had in mind was to be able to do this all in one script
application, all subroutines are predefined.
------Save this is as an applet, replace <<>> with chevrons------
--<<event ascrpsbr>> {4} given <<class snam>>:"foo"
Callsubroutine {4} given <<class snam>>:"foo"--this won't compile,
delete this line & uncomment above line to compile
on foo(arg)
return arg
end foo
--------------------------------------
From the Event Log:
tell current application
foo(4)
end tell
--> {4} doesn't understand the Callsubroutine message.
--------------------------------------
Trying the call subroutine with "my" or "of me" will cause it to not
compile.
As Neal explained, it works fine when calling another applet with this
method.
Thanks again.
cheers
ehsan