need help in this

Asked by aaysh

Here is the coding
http://i1045.photobucket.com/albums/b457/aayushbagga11/sikuli.jpg

wait ( ,60)----> this waits for 60 secs for next button to appear

for more details see image

if next button not comes script crashes
i tried to use if else to specify if button deosnot comes what to do

but script is still crashing
please provide me proper code to handle this as i am new in sikuli

I will be very thankfull

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

for m in range(200):
    if exists("image-of-next-button.png", 20):
        click(getLastMatch())
    else:
        click("image-of-skip-this-video-button")

If the next-button does not come up within 20 seconds, we try to click the other button (which has to be visible in this case!)

Revision history for this message
RaiMan (raimund-hocke) said :
#2

If this does not work:
paste the error message

Revision history for this message
aaysh (aayushbagga11) said :
#3

code
for m in range (200):
   if exists( , 20):
       click(getLastMatch( ))
   else:
       click( )

Error Message
[error] Stopped [error] An error occurs at line 3 [error] Error message: Traceback (most recent call last): File "C:\DOCUME~1\WinXP\LOCALS~1\Temp\sikuli-tmp85825583312251643.py", line 3, in click(getLastMatch("1311763144437.png")) TypeError: getLastMatch(): expected 0 args; got 1

please solve this for me
Thankyou

Revision history for this message
RaiMan (raimund-hocke) said :
#4

You should have used it as written: click(getLastMatch( ))

and not something like:
click(getLastMatch("1311763144437.png"))

a find operation stores the last match in the region that was searched (Screen(0) or SCREEN in your case). getLastMatch just retrieves this match from the region and returns it.

Revision history for this message
RaiMan (raimund-hocke) said :
#5

did you ever had a look in the docs?
http://sikuli.org/docx/

if you have some problems with any function (like getLastMatch in this case) looking in the index might help:
http://sikuli.org/docx/genindex.html

Nevertheless, feel always free, to post any question - being asked wether already looked into the docs might be the price you pay ;-)

Can you help with this problem?

Provide an answer of your own, or ask aaysh for more information if necessary.

To post a message you must log in.