In article <4b6c8e7b.8000...@gmail.com>, Todd <t.greenwoodg...@gmail.com> wrote: > I'd like to perform some window management via appscript on Mac OSX > (10.6.2). > > This is pretty straightforward using AppleScript (see code#1 below). > However, my attempts to perform the same tasks in python appscript have > failed: > > 1. get bounds of display > 2. get bounds of foreground process > > I can query the 'System Events' for the process list, and get the > foremost process...however, I cannot get the bounds from the windows. > (see code#2 below). > > The appscript error is: > ------------------------------------------------ > CommandError: Command failed: > OSERROR: -1728 > MESSAGE: Can't get reference. > OFFENDING OBJECT: > app(u'/System/Library/CoreServices/System > Events.app').application_processes[u'iTerm'].windows[u't...@greenmachine:
You need to get a windows reference from each application's object, not from a System Events app object: >>> bounds_tuple = app('Terminal').windows.first.bounds() >>> print bounds_tuple (675, 310, 1330, 820) -- Ned Deily, n...@acm.org _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig