← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #267301]: having a problem getting the region of an open window in 1.1

 

Question #267301 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/267301

    Status: Open => Answered

RaiMan proposed the following answer:
a problem one faces with many modern Windows apps: there might be
"hidden" windows, that are outside the visible screen or have a width
and height <= 1.

currently the only hack:

for nw in range(100):
    w = Region(someApp.window(nw))
    if not w: break
    print nw, w # for debugging only
    if (w.x < 0 or w.y < 0 or w.w < 100 or w.h < 100): continue
if not w: 
    print "no window"
    exit(1)

-- comments

----might be a typo:
myApp = ("Charlie")

should be 
myApp = App("Charlie")

--- regCharlie = Region(charlieVM.focusedWindow())

focusedWindow()
is a class method and should be used as

App.focusedWindow()

it simply returns the window, that currently is the frontmost (owned by
whatever app)

You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.