Mac: focusedWindow taking very long and returns null

Asked by tombrus

I use App.focusedWindow() to find the focused window of my app. I know that my app is currently active.
When my normal app window is in front I get a sensible answer with 50 ms or so.

>>> When I have a progress dialog in front it takes 6000 ms and returns null. This is too long and null is of little help!

Recognising dialogs is what I actually want to do.
My app is an eclipse RCP app. I use Mac OSX 10.9.4 and sikulix 1.1.0-Beta1.
focusedWindow() dives into native code fairly quick so there is little I can debug here.

Any help appreciated...
Tom

Question information

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

The App features regarding the windows handling (especially on Mac) might have many room for improvements, but sorry, this is not my current focus.

If you really need better support for some app handling on Mac, have a look at the AppleScript options you have, using osascript from with in a SikuliX script.

I know that it works, since I tried it 2 or 3 years ago (but besides the memory about having it done, I have nothing to share)

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

Understand RaiMan...

I need my tests to be running on Mac & Windows & Linux, so I need the full range of platforms supported.

I implemented a workaround: if it takes more then 500ms to get the focussed window (done in a separate thread) I time out and regard it as an indication that a dialog is up. If the other platforms behave well this timeout will never be reached and the same code will behave nicely.

Will do for now...

Revision history for this message
tombrus (tombrus) said :
#3

Thanks RaiMan, that solved my question.