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

Asked by arminius

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:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
arminius
Solved:
Last query:
Last reply:
Revision history for this message
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

Revision history for this message
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

Revision history for this message
arminius (arminius75) said :
#3

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