Ned,
Thanks! That unblocked me. I changed my code to enumerate over the
applications, and then create an app instance from that.
// get the front most app from system events
se_app_name = se.processes...name.get()
// get the actual application
real_app = app(se_app_name)
// get the windows for the app
real_app.windows()
etc.
Works like a charm, tho some apps, like firefox, have a System Event
name that I cannot simply call 'app(name)' on. I'll sort that out later.
Thanks again.
-Todd
On 2/5/10 2:21 PM, Ned Deily wrote:
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)
_______________________________________________
Pythonmac-SIG maillist - Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig