"while (count < 10):" loop doesn't seem to be working

Asked by arminius on 2017-07-02

I have this other code "while (count < 46):
            click(Pattern("1486584943427.png").similar(0.69).targetOffset(-340,86))
            count = count + 1"

and it works fine.

I tried to turn that into this code "while (count < 10):
        x1 = 640
        y1 = 512
        x2 = 660
        y2 = 530
        dragDrop(Location(x1,y1),Location(x2,y2))
        count = count + 1"

it just skips over the above like it doesn't exist, doesn't throw an error, just ignores it.

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
arminius
Solved:
2017-07-04
Last query:
2017-07-04
Last reply:
2017-07-03
masuo (masuo-ohara) said : #1

In the article "Controlling Sikuli Scripts and their Behavior", there is an explanation about situations where the operation is not processed as expected.

See "Usage:" at the following page.
http://sikulix-2014.readthedocs.io/en/latest/scripting.html?highlight=DelayBeforeDrop

Manfred Hampl (m-hampl) said : #2

Another potential pitfall: what is the value of count before the loop?
If you re-use a counter from a previous loop, it might already be > 10

arminius (arminius75) said : #3

thanks, forgot to put a "count = 1" just before it.