Re: Script Objects
Re: Script Objects
- Subject: Re: Script Objects
- From: Michael Terry <email@hidden>
- Date: Thu, 17 Oct 2002 02:24:10 -0700
On 10/16/02 11:06 PM, "email@hidden" <email@hidden> wrote:
>
> You're on the right track. In order to load handlers from another file do
>
> this: Strip off the "script/end script" wrapper from the handler you choose
>
> to use and save it as a compiled script somewhere. Then call it with this
>
> syntax:
>
>
Why should one "Strip off the "script/end script" wrapper"?
Removing the script wrapper isn't necessary, but it's more convenient to
call the handler that way. Consider:
script Prime_Minister
on talk()
say "Don't be so humble. You're not that great."
end talk
end script
saved in a file in OS X's scripts folder. To call it from another file, we
need something of this sort:
property Israel : load script alias ((path to scripts folder from user
domain as text) & "nation")
set Golda_Meir to Prime_Minister of Israel
tell Golda_Meir to talk()
If we remove the script wrapper from the Prime_Minister script, then to call
it we need only write:
tell Israel to talk()
A script file is a script object by itself already. You could think of the
script wrapper as being implicit.
There are cases where you might want to bundle multiple script objects in
one file, in which case the script/end script device is necessary. But, in
this case, we're just talking about a simple library handler which doesn't
keep track of any data, so the easier the better.
>
Gunno Ivansson
Mike
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.