sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #18519
Re: [Question #230535]: app opens on random screen across multiple monitors
Question #230535 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/230535
Status: Open => Answered
RaiMan proposed the following answer:
this is the simplest version:
def waitAllScreens(image, elapse = 0):
start = time.time()
while True:
for n in range(getNumberScreens()):
if Screen(n).exists(image, 0):
return n
if time.time()-start > elapse:
return -1
wait(1)
-- usage as one time check:
sid = waitAllScreens("some app visual.png")
if sid < 0:
print "App not open on any screen"; exit(1)
appScreen = Screen(sid)
-- usage with a waiting time:
sid = waitAllScreens("some app visual.png", 30)
if sid < 0:
print "App not open on any screen after waiting about 30 seconds"; exit(1)
appScreen = Screen(sid)
One could use a background observe for each screen with onAppear(), but the setup for this is much more complicated and IMHO does not justify the effort.
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.