Re: WindowID to front
Re: WindowID to front
- Subject: Re: WindowID to front
- From: Peter Lübke <email@hidden>
- Date: Mon, 28 Feb 2011 12:39:35 +0100
I'm pretty sure you don't really need CGWindowListCopyWindowInfo() to
do this.
Am 28.02.2011 um 11:51 schrieb Benedikt Iltisberger:
Hi Peter,
exactly what I thought. But how do I obtain the AXUIElementRef of a
window which I looked up from the Window-Server (with
CGWindowListCopyWindowInfo)?
First of all, by which criteria do you select the window in
CGWindowListCopyWindowInfo() ?
What kind of informations do you have about the window?
Iterate over the kAXWindowsAttribute elements. For each AXWindow
element, get the attribute value for the attribute you know
( AXUIElementCopyAttributeValue() ) until this value is equal to the
desired value.
In other words: (Example) I have 4 Finder windows and I want to
AXRaise a certain one.
Therefore I create a list with CGWindowListCopyWindowInfo and
select the right one.
But how can I come from this step to the equivalent AXUIElementRef,
which I need to have in order to set the AXRaise?
Sorry for bothering you like that but I guess this is also an
interesting issue for other users.
Your'e welcome...
Cheers,
Benedikt
On 28.02.2011, at 11:19, Peter Lübke wrote:
There's no problem accessing a window by its (application
specific!) ID by AppleEvents / AppleScript.
(Must have been decades since you last opened Script Editor,
Uli :-) ).
Of course this depends on the application supporting AppleEvents...
Just run this script in Script Editor:
tell application "<otherApplication>"
properties of every window
end tell
Look at the result to see whether there´s an ID property.
Since I guess Benedict is working in the sphere of Accessibility
anyway, it might indeed be more appropriate to just call AXRaise
on the AXWindow element.
The reason I proposed AppleEvents was because he was asking for
adressing the window by its ID.
Am 28.02.2011 um 10:33 schrieb Uli Kusterer:
On 27.02.2011, at 13:55, Benedikt Iltisberger wrote:
But how can I now set the selected window ID to front?
(Note: It is a window of a foreign application which I want to
set to front. My own app wouldn't be a problem.)
Not sure you can use that information for anything (I don't think
AppleScript deals in Window IDs, but that may have changed since
I last had to put up with it). You may have more luck using the
accessibility APIs to both list the windows and then bringing one
to front.
Cheers,
-- Uli Kusterer
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden