increased clicks

Asked by Sao

If I want to first do some stuff then click an image +1 time for every round, so first time no click, second time 1 click, third time 2 clicks and so on up to 99 clicks the 100th round.
How would i do that? Tried a lot of variations using for loops but without the wanted result.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Sao
Solved:
Last query:
Last reply:
Revision history for this message
Karl (k-d) said :
#1

Please post what you've tried.

Revision history for this message
Sao (e-bm) said :
#2

Like:

for i in range(1,100):
    click(1.png)
    do other stuff

And:

t = find(1.png)
i = 0

for i in range(1,100):
    click(t)
    do other stuff
    i +=1

Revision history for this message
Karl (k-d) said :
#3

for i in range(1,10):
    print "------------", i
    for j in range(1,i):
        click(1.png)
        #do other stuff

Revision history for this message
Sao (e-bm) said :
#4

This:

for i in range(1,10):
    print "------------", i
    for j in range(1,i):
        click("1.png")
        print(j)
        wait(1)

Gave me this output:

------------ 1
------------ 2

[log] CLICK on L(1065,841)@S(0)[0,0 1920x1080]

1

------------ 3

[log] CLICK on L(1065,841)@S(0)[0,0 1920x1080]

1

[log] CLICK on L(1065,841)@S(0)[0,0 1920x1080]

2

------------ 4
[log] CLICK on L(1065,841)@S(0)[0,0 1920x1080]

1

[log] CLICK on L(1065,841)@S(0)[0,0 1920x1080]

So no increase in number of clicks

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

sorry, Karl's answer is correct (I did oversee, that you want to click one less than the count of rounds.
In each round you click round-number - 1 times.

but at least this is true:
if you want to run 100 rounds (1 to 100), then it must be:
for i in range(1, 101):

if you want to do other stuff after the range of clicks, then you have to move it out of the second loop

Revision history for this message
Sao (e-bm) said :
#7

My bad, forgot to move things out of second loop.

Ty both of you