← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #225014]: sequential numbers

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
this would do it:

def avengers(n):
    paste("avengers%d@xxxxxxxxx"%(n))
    click(wait("Movingonestc.png",FOREVER))
    click(wait("Youcertainly.png",FOREVER))
    hover(wait("SLnIt.png",FOREVER))
    hover(wait("SLnIt.png",FOREVER))
    hover(wait("SLnIt.png",FOREVER))
    hover(wait("SLnIt.png",FOREVER))
    hover(wait("SLnIt.png",FOREVER))
    click(wait("SLnIt.png",FOREVER))
    click(wait("Letstakethis.png",FOREVER))
    hover(wait("LnLL4.png",FOREVER))
    hover(wait("LnLL4.png",FOREVER))
    hover(wait("LnLL4.png",FOREVER))
    hover(wait("LnLL4.png",FOREVER))
    hover(wait("LnLL4.png",FOREVER))
    click(wait("LnLL4.png",FOREVER))
    click(wait("ldontbelieve.png",FOREVER))
    hover(wait("Ln.png",FOREVER))

avengers(1)
avengers(2)
avengers(3)
# .... and more

I use paste() instead of type, because a @ cannot be typed currently (as
far as I know - or does it work on a US keyboard?)

BTW: strange sequences:

    hover(wait("SLnIt.png",FOREVER))
    hover(wait("SLnIt.png",FOREVER))
    hover(wait("SLnIt.png",FOREVER))
    hover(wait("SLnIt.png",FOREVER))
    hover(wait("SLnIt.png",FOREVER))
    click(wait("SLnIt.png",FOREVER))

This only makes sense, if
- SLnIt.png appears and then vanishes again after a minimum of about one second
- then comes back again and vanishes again after a minimum of about one second
- this happens again three times the same way
- and the next time you want to click the image finally

If this is your intention, then the following would be more robust:
    wait("SLnIt.png",FOREVER)
    for n in range(5): # repeat five times
        waitVanish("SLnIt.png",FOREVER)
        wait("SLnIt.png",FOREVER)
    click(getLastMatch())

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