• 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: Unwinding the containment hierarchy of a reference
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Unwinding the containment hierarchy of a reference


  • Subject: RE: Unwinding the containment hierarchy of a reference
  • From: "Scott Babcock" <email@hidden>
  • Date: Tue, 7 Dec 2004 13:16:21 -0800
  • Thread-topic: Unwinding the containment hierarchy of a reference

No, what I'm looking for is a way to determine that document 2 is the
container of word 12, and that application "TextEdit" is the container
of document 2.

This information is encoded in the reference; otherwise, AppleScript
would have no way to resolve it. The question is: Can this containment
information be extracted from the reference in any reasonable way?

-----Original Message-----
From: Michelle Steiner [mailto:email@hidden]
Sent: Tuesday, December 07, 2004 1:07 PM
To: Scott Babcock
Cc: email@hidden
Subject: Re: Unwinding the containment hierarchy of a reference

On Dec 7, 2004, at 1:44 PM, Scott Babcock wrote:

> Given an arbitrary AppleScript object reference, is there a reasonable
> way to determine the object's containment hierarchy? For example:
>
> tell application "TextEdit"
>     set x to a reference to word 12 of document 2
> end tell
>
> Is there a programmatic way to determine that word 12 is contained by
> document 2, which is contained by application "TextEdit"?

I don't understand what you mean.  Are you asking if there is a way to
tell whether there is a document 2, and if there is a document 2, is
there a word 12?  If that's what you're asking, here is one solution.

tell application "TextEdit"
	if document 2 exists then
		tell document 2
			if word 12 exists then
				display dialog (word 12 as text)
			else
				display dialog "Word 12 of document 2
does not exist."
			end if
		end tell
	else
		display dialog "Document 2 doesn't exist"
	end if
end tell

--
We're surrounded. That simplifies the problem.

 _______________________________________________
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

  • Follow-Ups:
    • Re: Unwinding the containment hierarchy of a reference
      • From: Andrew Oliver <email@hidden>
    • Re: Unwinding the containment hierarchy of a reference
      • From: Michelle Steiner <email@hidden>
  • Prev by Date: Re: Unwinding the containment hierarchy of a reference
  • Next by Date: Re: Unwinding the containment hierarchy of a reference
  • Previous by thread: Re: Unwinding the containment hierarchy of a reference
  • Next by thread: Re: Unwinding the containment hierarchy of a reference
  • Index(es):
    • Date
    • Thread