[Pythonmac-SIG] py-appscript problem in crontab

Ned Deily nad at acm.org
Mon Mar 3 08:19:23 CET 2008


In article <47C8C907.7040800 at wheel.org>,
 tom wible <airdrummer at wheel.org> wrote:
> btw, i figured out why i wasn't getting any mail from crontab: no 
> output...d'oh!-} but i can't figure out how to get useful info out:
>  >>> print 
> app(u'/Applications/EyeTV.app').window[its.name.beginswith('EyeTV')].close()
> 
> returns [None] no matter whether there is or isn't an EyeTV window...

It's up to the application to decide what it wants to return.  In this 
case, it appears EyeTV returns nothing in response to a close.  One of 
the joys of dealing with scriptable applications, regardless of the 
scripting language (py-appscript, Applescript, etc.), is figuring out 
the application's object model and how its objects respond to various 
commands.  You can use introspection tools like appscript's help() 
method, ASDictionary.app, or Apple's Script Editor.app to get at an 
application's script dictionary.  But you'll have to experiment a bit to 
see how the application actually responds in practice.

For example, the EyeTV application object has a property "playing":

  etv = app('EyeTV')
  if etv.playing():
      for window in etv.player_windows():
          window.close()

Hope that helps.

-- 
 Ned Deily,
 nad at acm.org



More information about the Pythonmac-SIG mailing list