Andrew Wu wrote:

> My team is using py-appscript to do some automated testing (via the
> UI).  We really like the entire_contents() call because it gives us
> all the UI elements for a given application (as referenced via
> app('System Events').processes[app_name]).  However, entire_contents()
> seems to return a list, and we lose the advantage of generating
> complex queries to discover information about a set of objects.
> Instead we've found ourselves having to iterate over the list and
> querying each item of interest in the list, which results in a
> significant performance hit.
> 
> I have 2 primary questions:
> 
> a) Is there a way to create complex queries on entire_contents in this
> context, or am I stuck iterating over the list that is returned?

Doesn't look like it. System Events declares the property's type as 'list [of 
references]'. (Compare with Finder's 'entire contents' property, which is 
declared as 'reference'.) So you have to retrieve the entire list before you 
can do anything with it.


> b) The same operation on the resultant list on Snow Leopard (10.6.3)
> seems to run 4x slower than on Leopard (10.5.8), discounting hardware
> differences.  Is there a way for me to setup the appscript
> installation to mitigate this performance hit?

Have you tried running 32-bit on both to see if it's a 32-/64-bit issue? 
Otherwise, I'm guessing any performance hit will be in OS X/System Events, 
though you'd need to profile your code to be sure.

HTH

has
-- 
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG

Reply via email to