For Loop problem

Asked by Shawn Robertson

I have read the FAQ #1413737 and that didnt really help me understand what i am trying to do.

I want to use the For Loop and the FAQ above didnt mention the for loop like i have seen in other areas.

here is my code:

def billassist(x):
    type('b', KeyModifier.ALT)
    type('b')
    waitVanish(Pattern("Client-1.png").similar(0.94), 120)
    type('w', KeyModifier.CTRL)

for x in range(0, 10):
    billassist(x)

i want to run that function 9 times one after each other but the problem is it doesn't perform exactly like i want.

I expected the loop to run the method once and then when the method completes run again but instead the for loop just runs it 9 times repeatedly all at once and not only do i not get my expected results but my program is bogged down because its receiving 9 commands at once or back to back really fast instead of 9 set of instructions one at a time after the previous attempt finished.

What am I doing wrong?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Shawn Robertson (shawn-robertson) said :
#1

I figured out what i did wrong, i didnt have a wait command between

type('b')
waitVanish(Pattern("Client-1.png").similar(0.94), 120)

my new code is:

def billassist_open_close(id):
        type('b', KeyModifier.ALT)
        type('b')
        wait("BillingAssis.png", 120)
        wait(Pattern("1366833700322.png").similar(0.94), 120)
        waitVanish(Pattern("1366833700322.png").similar(0.96), 120)
        type('w', KeyModifier.CTRL)

for x in range(0, 20):
    billassist(x)

and it runs fine now.

doh need to check my code better next time, sorry guys.

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

solved by user