If an application has multiple windows, how can I bring anyone of them onto the most front of the screen?

Asked by esxer

I want to do image matching on that window so I asked this question. If anybody has good method, please share with me. :)

Thanks in advance,
John

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

Windows or Mac?

Revision history for this message
esxer (esxer) said :
#2

I used Mac for now, but if you can give me some solutions on both Windows and Mac platforms, it will be really appreciated. :-)

Thanks RaiMan.
John

Revision history for this message
RaiMan (raimund-hocke) said :
#3

--- Windows
Here it is possible to select an opened app window by knowing some part of its window title text.
Using switchApp("some text") or App("some text").focus() will bring the respective window to front, if it contains "some text" in its window title.
You have to play a little bit around with it, to find out what is best for your situation.

--- Mac
The solution on Mac behind switchApp() and class App is different to Windows. Here you access a process with these functions, which could have multiple windows open. You will not get any information from Sikuli, which of these windows is frontmost and Sikuli on Mac has no feature to make a specific window the frontmost.
Here you have to either simulate mouse actions/key strokes to handle the windows or use AppleScript from Sikuli (call a script using os.popen("osascript ...") to tell a specific window to come to front.

If not already done, it is of value to read through the doc chapter: http://sikuli.org/docx/globals.html#controlling-applications-and-their-windows

Can you help with this problem?

Provide an answer of your own, or ask esxer for more information if necessary.

To post a message you must log in.