← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #680383]: hopefully (2) easy questions (region.focus & code consolidation)

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
at 1---
App.open("D:\\Program Files\\Nox\\bin\\Nox.exe")
sleep(15)
App.focus("NoxPlayer")
reg = App.focusedWindow()

or
app = App("D:\\Program Files\\Nox\\bin\\Nox.exe")
app.open(15) # does the focus as well
reg = app.window(0)

... the docs are showing ;-)
https://sikulix-2014.readthedocs.io/en/latest/appclass.html#the-application-class-app

at 2---
your problem surely is, that you have too many waits in your code, that are absolute.
example from above:
App.open("D:\\Program Files\\Nox\\bin\\Nox.exe")
sleep(15)
App.focus("NoxPlayer")
... sleep(15) waits 15 seconds, no matter what really happens
better:
app = App("D:\\Program Files\\Nox\\bin\\Nox.exe")
app.open(15) # does the focus as well
reg = app.window(0)
... open waits MAX. 15 seconds for the app to open. script continues at the moment, the app is open (might be after 3 seconds)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.