Log how many times image is clicked

Asked by Drei Alexander on 2018-02-24

Hi All!

I'm still new into sikuli, please bear with me. =)

I've finally setup a basic script and its running fine but now I wanted to log how many times the script looped and like how many times an image is clicked.

my script is something like this, its already looping back from beginning but wanted to track them.

---------------------------------------------
while True

if exists(image):
    click(image)
--------------------------------------------

Thanks

---------------------------------------------------------------------
a solution:

loopCount = 0
clickCount = 0
while True
    loopCount += 1
    if exists(image):
        click(image)
        clickCount += 1
   print "loops:", loopCount, " clicks: ", clickCount

If you want to have logging with a time stamp:
http://sikulix-2014.readthedocs.io/en/latest/scripting.html#writing-and-redirecting-log-and-debug-messages

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2018-02-24
Last query:
2018-02-24
Last reply:
2018-02-24
Drei Alexander (drei476) said : #4

Thanks RaiMan, that solved my question.