Re: Inheritance and Loaded Libraries
Re: Inheritance and Loaded Libraries
- Subject: Re: Inheritance and Loaded Libraries
- From: has <email@hidden>
- Date: Thu, 28 Oct 2004 21:38:26 +0100
Paul Berkowitz wrote:
> To have Script Runner run a copy of myScript while giving that script
direct access to its own state - which is what I assume you want to
> do - use the following solution:
But he already has a solution, has. Have you read David's message
carefully? [...] The question was why doesn't 'loadedScript's
runHandler()' work.
I did read it, and I said why it doesn't work: AppleScript doesn't
work like scriptable applications do (specifically, you can't send
references via Apple events), so he needs to get a copy of the XLib
script from the application in order to call its handlers locally,
e.g. 'runTest() of (get XLib of application "ScriptRunner")'. Whether
or not my answer was clear enough that anyone else could follow it is
another question, but it was an answer.;)
If there's an interesting question here, it's why 'tell my XLib to
runTest()' should have worked? In fact, this approach just blows up
further down the line, so isn't really a solution at all, e.g. the
following will give a "<<script>> doesn't understand the sayThing
message" error:
Exhibit 2 - The Script Library: A Compiled Script
on runTest()
sayThing()
end runTest
on sayThing()
say "a Lib"
end sayThing
Short response: the OP should use one or other of the two solutions I
provided, and not rely on bugs in AppleScript to make things sorta
work when they shouldn't.
has
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
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