[Pythonmac-SIG] deconstruct a py-appscript reference

Nicholas Riley njriley at illinois.edu
Fri Dec 11 23:29:55 CET 2009

On Fri, Dec 11, 2009 at 01:57:32PM -0800, Mark Sanvitale wrote:

> Thus, my question is how can I get the id directly out of such a
> reference?  Presumably, via some means more elegant than parsing a
> string version of the reference.  (So far, I have gotten as far as
> poking around myRef.AS_appdata and myRef.AS_aemreference but have
> not yet found the magic word.)

myRef.AS_aemreference._key should do it.  I don't see another way to
access this information.

AEM/appscript uses inheritance pretty extensively, so you may find it
useful to look at the hierarchy.  For example:

   In [54]: type(s.AS_aemreference).mro()
   [<class 'aem.aemreference.ElementByID'>,
    <class 'aem.aemreference._SingleElement'>,
    <class 'aem.aemreference._PositionSpecifier'>,
    <class 'aem.aemreference.Specifier'>,
    <class 'aem.aemreference.Query'>,
    <type 'object'>]
Nicholas Riley <njriley at illinois.edu>

More information about the Pythonmac-SIG mailing list