Re: set parent
Re: set parent
- Subject: Re: set parent
- From: Richard Morton <email@hidden>
- Date: Tue, 6 Aug 2002 13:07:21 +1000
On Tuesday, August 6, 2002, at 10:37 AM, email@hidden wrote:
I am getting an error that I can't set parent to <<script>>, and I think
that that's rather odd.
The situation is as follows:
foo.scpt----------------------------------------
property child : ""
on run
set child to load script file "disk:folder:bar.scpt"
tell child to init(me)
end run
bar.scpt--------------------------------------
on init(owner)
set parent to owner
end init
But when I run, I get an error that I "Can't set parent to
<<script>>". I
thought that setting parents to scripts was the whole point; obviously,
I'm
missing something or setting this up wrong.
Can anyone help?
Only to say I don't think what you're doing is directly possible. The
parent property is compile time only I believe - it cannot be changed
during a run. Not sure whether it meets your requirements, but this is
how you could do it:
property parent : load script file "disk:folder:bar.scpt"
If you want to do something else during compile, you could call a
previously declared handler which loads the script as well as whatever
else is required:
to setUp()
-- do set up things
return (load script file "disk:folder:bar.scpt")
end
property parent : setUp()
Cheers,
Richard Morton
-- Frank Zappa's Guidelines for Healthy Living, #12: "Don't eat the
yellow snow"
_______________________________________________
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.