Re: WindowID to front
Re: WindowID to front
- Subject: Re: WindowID to front
- From: Benedikt Iltisberger <email@hidden>
- Date: Mon, 28 Feb 2011 15:10:51 +0100
Hey Peter,
I did it exactly like you proposed. Works perfect :-)
I am using following calls to make a selected window front most:
AXUIElementPerformAction(windowElement, kAXRaiseAction);
AXUIElementPerformAction(windowElement, kAXIncrementAction);
I simply used the fact that CGWindowListCopyWindowInfo and kAXWindowsAttribute arrange their arrays in the same order.
I did some testing and its working fine :-)
Thank you very much and I hope you are going to have a decent bavarian Weissbier tonight. I am going to have one for sure :-)
Kind regards,
Benedikt
On 28.02.2011, at 13:34, Peter Lübke wrote:
> Uli,
> I apologize for my silly comment.
>
> Of course you are absolutely right.
> I totally overlooked you were refering to a User Session window ID, which is totally different from an application specific window ID.
>
> Cheers,
> Peter
>
> Am 28.02.2011 um 11:19 schrieb Peter Lübke:
>
>> 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
_______________________________________________
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