0

here is what I need to do. Please let me know what I should add or change.

Problem: In the task I'm having, sometimes there is a random popup with a slider. When this pops up, Sikuli will throw a FindFailed exception. Instead I would like this script to scan for an image and do the slide action and then retry looking for what it was looking for before. I'm pretty sure it's just a couple of lines I need to add at the top of the code.

Example: let's say if it can't find 5.png, it will throw a prompt asking for user input. Instead, I want it to search for the image then do a slide action and then start looking for image 5.png again and continue.

Code below:

Region(example Region)
setFindFailedResponse(PROMPT)
Settings.MoveMouseDelay=0
click("1.png")
click("2.png")
click("3.png")
click("4.png")
click("5.png")
click("6.png")
click("7.png")
Michel Floyd
  • 18,793
  • 4
  • 24
  • 39

1 Answers1

0

Maybe you could make a loop that detects if a certain pop-up appeared.
For example you could make it look if the pop-up header is present.
When that is True you can use PopUp = App.focusedWindow().
Then PopUp is the region defined, exactly the pop-up only.

Then make a picture of the slidebar, if that one is visible within PopUp you can use 'mouseDown()' and mouseUp().
Then look again if that image exists.

For looking if an image exists or not you can use:

if exists(image5): 
    # Do something
else:
    # Do something else 

For looking for an image within the Pop-up window you could use:

if PopUp.exists(imageScrollbar): 
    # Do something 

When I make Sikuli use the scrollbar I usually make a picture of the 3 stripes on the scrollbar.

Tenzin
  • 2,415
  • 2
  • 23
  • 36