Finding Two different images
looking to find 2 different images withing a given time for eg: 3 sec, only if it finds BOTH of the images it should do something (popup, got 2), Not sure what I'm doing wrong, please advise:
def findTwoImages(
twoImages = False
imageCount = 0
if exists(
imageCount += 1
if exists(
imageCount += 1
if (imageCount == 2):
findTwoImages()
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Sikuli Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- xyz_User
- Solved:
- 2019-09-23
- Last query:
- 2019-09-23
- Last reply:
- 2019-09-22
This question was reopened
- 2019-09-22 by xyz_User
RaiMan (raimund-hocke) said : | #1 |
that's not Python ;-)
I would do it like this (if the function makes sense at all, only if needed more than once)
def findTwoImages(
imageCount = 0
if exists(first): #waits 3 secs for first
imageCount += 1
if exists(second): #waits 3 secs for second
return mageCount == 2
if findTwoImages(
popup('got 2')
This only works, if the first image appears within 3 seconds (no matter what is with the second image).
You might also have a look at the feature findAny().
xyz_User (userseven) said : | #2 |
I am full of gratitude once again, I promise to stop asking questions for the next little while :)
RaiMan (raimund-hocke) said : | #3 |
No Need to stop asking.
It is my decision wether, when or how I answer ;-)
xyz_User (userseven) said : | #4 |
I seem to be getting an error as well:
testingThisFunc
Here's the code:
def testingThisFunc
imageCount = 0
if squareArea2.
imageCount += 1
if squareArea4.
return imageCount == 2
if testingThisFunc
doubleClick
click(
callMyNextF
waitForUi()
else:
sleep(0.1)
Manfred Hampl (m-hampl) said : | #5 |
You cannot call 'testingThisFun