[1.1.0] App class: OS X: getWindow() title of app's frontmost window

Asked by Jan W.

Hi,

i tried many ways to use the new getWindow() introduced in Build: 2015-05-08

Is that a windows only or am i doing something completely wrong?

i tried (for me the most obvious)
print myapp.getWindow()
for example and expected it to print the current focused window title or an object.

a small code snippet would be nice.

Best regads
Jan

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

works on Windows and Mac.

for Mac

--1: create an App object:

myApp = App("Safari")

--2: make sure it is running with some frontmost window

myApp.open()

... and make sure, the window is visible

since with App.open() not always the window information is already available:

myApp.focus() # to refresh the title info in doubt

print myApp.getWindow() # should now print the window

-- for debugging purposes:
print myApp

gives you something like
[10498:Safari (Question #267039 : Questions : Sikuli)] Safari

which is
[nPID:executableName (main/frontmost window title)] given text

see:
http://sikulix-2014.readthedocs.org/en/latest/appclass.html#the-application-class-app
the chapter: How to create an App instance

Sorry, more is not yet documented yet ;-)

Can you help with this problem?

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

To post a message you must log in.