• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: set parent
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.
References: 
 >set parent (From: email@hidden)

  • Prev by Date: About iso.8601 in AppleScript
  • Next by Date: Filemaker text formatting
  • Previous by thread: set parent
  • Next by thread: Re: set parent
  • Index(es):
    • Date
    • Thread