UI scripting, windows order
UI scripting, windows order
- Subject: UI scripting, windows order
- From: "Scott P. Richert" <email@hidden>
- Date: Thu, 16 Jan 2003 10:53:52 -0600
nino wrote:
I've tested this with Textedit and few other applications. If the
application targeted with system events has two or more windows
opened then
window 1 is not necessarily the front window.
The problem is that windows for system events doesn't have a front
property,
and apparently the focus property is always false.
Assume you have opened textedit and created 2 windows "untitled 1" and
"untitled 2" with the latter in front, asking system events for
name of window 1 of process "textedit"
will result "untitled 1".
Is this a bug?
nino
It's certainly not a feature ;). I've run into this, too. Here's a
bit of code which should open the bookmarks drawer on the frontmost
Chimera window if it's not already open:
tell application "Navigator"
activate
end tell
tell application "System Events"
tell process "Navigator"
try
get properties of drawer 1 of window 1
on error
click button "Sidebar" of tool bar 1 of window 1
end try
end tell
end tell
Instead, it usually (though it seems, not always) opens the first
window opened. I find that I have to use "last window" instead of
window 1 in order to accomplish what I want, but that still assumes
(and this is a BIG assumption) that the frontmost window IS the last
window opened. If the order has changed, then I'm out of luck. (Of
course, you can work around it by bringing the last window forward
before opening the sidebar, but that defeats the purpose if you want to
open the sidebar on the current frontmost window.)
Scott
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.