• 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 (revisited)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unwinding the containment hierarchy of a reference (revisited)


  • Subject: Re: Unwinding the containment hierarchy of a reference (revisited)
  • From: has <email@hidden>
  • Date: Wed, 9 Feb 2005 12:40:55 +0000

Scott Babcock wrote:

The goal is to add text so that I can run the revised code to check for
the existence of named or indexed child elements or produce a filtered
list of child references.

Not sure what you mean. Can you clarify/give examples?


Is there a more graceful way to convert references to text?

Sure, though not in vanilla AppleScript. You'll need an osax or scriptable application to do it from AppleScript, or use another language like Python which, unlike AS, provides direct access to the Apple Event Manager's functions and objects. I'm sure I've suggested Python already: it's dead easy to do this kind of stuff there instead of banging your head off a wall trying to do it in AppleScript. See the aem/appscript project on my site and the Carbon.AE module in MacPython - there's scads of material there you can use or cannibalise to fit your needs.



Can I send
System Events object references to another application without System
Events getting involved?

Yup. A reference is just a bunch of object specifiers chained together. The recipient won't know it's a 'System Events' reference, of course, since object specifiers don't hold that information themselves. So if this application sends that reference back again then AppleScript will assume that reference refers to it, not to System Events. But if you're only sending it to be broken into text then that's not an issue.



I don't need to have the terminology resolved to friendly text; I
actually prefer raw codes in this context.

Not hard. You just grab the topmost object specifier and recursively extract its contents into a list. Easily doable in C, Python or Perl.



Having the ability to process
"foreign" object references will be useful for other tasks as well, like
getting a reference to an object's parent.

That's really something you should ask the target application to do for you (assuming it provides that facility), since it's the only one that truly understands what a givent reference actually means. There's no guarantee that pulling the topmost object specifier off a reference will yield a reference to the referenced objects' container - that's not how it works.


HTH

has
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
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


  • Prev by Date: Re: where are the shell scripts ?
  • Next by Date: Re: HOWTO check if file is completly copied - OS9
  • Previous by thread: Unwinding the containment hierarchy of a reference (revisited)
  • Next by thread: Re: DVDSP and applescript
  • Index(es):
    • Date
    • Thread