• 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: Parents/Child Scripts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Parents/Child Scripts


  • Subject: Re: Parents/Child Scripts
  • From: Lachlan Deck <email@hidden>
  • Date: Sun, 12 May 2002 14:56:25 +1000

Hi there,

From: has <email@hidden>

Lachlan Deck wrote:

(a peek inside parent script)
[...]
try
set childScript to (load script <path to script> as alias)
tell childScript
receiveText(theText)
end tell
on error
display dialog "No such script."
end try

OT note: you need to be more specific with your error trapping. If an error
should occur within receiveText(), the user would actually see a "No such
script" error - this would be totally inappropriate. Instead, wrap the try
block around _only_ the code it directly applies to (in this case the 'load
script' line).

Yeah, - it was just a quicky, but good to point out. :-)

(inside child script) [...]
Anyway yeah, this is the approach commonly used to load and access AS-based
libraries [aka mods]. The 'load script' command makes a fresh copy of the
loaded script object. You can store this object within another script and
send messages to it.

I'm really not sure you can characterise this relationship as parent-child,
however. It's purely a containment thing where one object contains another.

True.

[Maybe the experts could give a more definitive answer...]

Well I'm no AS expert but...
The following link has the info desired (I assume based on the question) for how to call a parent's method from a child script.
http://developer.apple.com/techpubs/macosx/Carbon/interapplicationcomm/AppleScript/
AppleScriptLangGuide/index.html

Then go to the section: Script Objects > Inheritance and Delegation.

There's a simple example in there about calling a parent method.

In short, in Java for example you'd call 'super'. In AS you use 'continue'...

with regards,

--
Lachlan Deck
email@hidden
_______________________________________________
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.

  • Prev by Date: Re: Parents/Child Scripts
  • Next by Date: Re: Parents/Child Scripts
  • Previous by thread: Re: Parents/Child Scripts
  • Next by thread: Re: Parents/Child Scripts
  • Index(es):
    • Date
    • Thread