• 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: inheritance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: inheritance


  • Subject: Re: inheritance
  • From: julifos <email@hidden>
  • Date: Thu, 15 Jan 2004 11:40:35 +0100

> Shouldn't a loaded script object inherit everything from the main script into
> which it was loaded.

No. It is a new instance of a script object with its own methods,
properties, etc.

> In other words shouldn't handlers within the loaded
> script object be able to see (and change the value of) variables declared as
> global in the main script? make use of handlers defined in the body of the
> main script? Or do I have to explicitly declare the main script as the parent
> of the loaded script object in order to inherit these things? If so, how does
> one refer to the top level script?

You must explicitly call "my parent". Eg:

#################### loaded script
to doIt()
set my parent's z to 4
end doIt
####################

#################### loader
property z : 3
set m to (load script alias "path:to:loaded")

m's doIt()
z --> 4
####################

If you use "set z to 4" in the doIt() handler, z won't be modified in the
"main" script.

jj
_______________________________________________
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.

  • Follow-Ups:
    • Re: inheritance
      • From: Axel Luttgens <email@hidden>
  • Prev by Date: Re: UI Scripting - Pastor.app
  • Next by Date: Re: Script expects quoted text mystery
  • Previous by thread: Re: inheritance
  • Next by thread: Re: inheritance
  • Index(es):
    • Date
    • Thread