If else

Asked by panaceyya

Help please with the script:
if found image0, click image1, then wait 1sec, click image2, click image3, wait 3s, press F5
if not found image0, press F5, return to the beginning of the scrypt like cycle 153 times.

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

Want to do more complex things like just a row of clicks and waits?
You have to get some basic Python knowledge (see faq 1858)
For indentation see: faq 1800

for i in range(153):
    if not exists(image0):
        type(Key.F5)
        continue
    # your stuff on indent level 1
    click image1,
    then wait 1sec,
    click image2,
    click image3,
    wait 3s,
    press F5

Revision history for this message
panaceyya (panaceyya) said :
#2

for i in range(153):
     if not exists(IMAGE1):
         wait(4)
         type(Key.F5)
         continue
     # your stuff on indent level 1
wait(,1)
find(Pattern(image1).similar(0.94))
click(Pattern(image1).similar(0.89).targetOffset(42,-3)),
wait(2)
click(Pattern(image2).similar(0.89).targetOffset(-340,-13))
click(Pattern(image3).similar(0.82).targetOffset(148,-4))
wait(4)
type(KEY_F5)

Ok its refreshes page if not found image1 and doesnt click img2,3

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

so what is the problem?

Revision history for this message
panaceyya (panaceyya) said :
#4

it doesnt clicks image1 !

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

tried with slow motion?

does the cursor move to image1?

any error messages?

BTW:

for i in range(153):
     if not exists(IMAGE1):
         wait(4)
         type(Key.F5)
         continue
     # your stuff on indent level 1
wait(,1)
find(Pattern(image1).similar(0.94))
click(Pattern(image1).similar(0.89).targetOffset(42,-3)),

are all these image1 the same images?

if yes:
for i in range(153):
     if exists(Pattern(image1).similar(0.94).targetOffset(42,-3)):
         break
     type(Key.F5)
     wait(4)
click(getLastMatch())

And again: pls read carefully at least through faq 1800

On the other hand I do not fully understand what you want to achieve.

Revision history for this message
panaceyya (panaceyya) said :
#6

buy somethings on steam market

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

ok, then all the best

Can you help with this problem?

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

To post a message you must log in.