Go to line in script

Asked by Ben

I have a very basic understanding so please take that into account if you can help :)

I have this code:

if exists(Pattern("1446404562207.png").exact()):
   type("w",KEY_CTRL)
else:
 click(Pattern("1446404655642.png").exact().targetOffset(-186,-2))
click(Pattern("1446404964069.png").exact())
wait(Pattern("1446404996477.png").similar(0.40).targetOffset(204,47),FOREVER)
click(Pattern("1446404996477.png").similar(0.40).targetOffset(204,47))
type("w",KEY_CTRL)

What i would like it to do is go back to line 1 or 2 or 3 etc of my code so that the script repeats itself and then goes in a cycle.

For example...

if exists(Pattern("1446404562207.png").exact()):
   type("w",KEY_CTRL)

GO TO LINE 1 OF SCRIPT

else:
 click(Pattern("1446404655642.png").exact().targetOffset(-186,-2))
click(Pattern("1446404964069.png").exact())
wait(Pattern("1446404996477.png").similar(0.40).targetOffset(204,47),FOREVER)
click(Pattern("1446404996477.png").similar(0.40).targetOffset(204,47))
type("w",KEY_CTRL)

GO TO LINE 2 OF SCRIPT

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

Generally: In the moment, the simple sequencing of click and wait is no longer sufficient, you have to do some basic investment into Python scripting. There are some good tutorials and training pages in the net.

For this looping stuff we have a faq 1437

Revision history for this message
Ben (benpersonal97) said :
#2

Unfortusntely I have very little knowledge so maybe I will have to invest sometime into learning the language. I'll take another look at faq but I didn't understand this before. Is there a way I can just loop my entire script rather than going to a certain line in the script?

Thank you

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

Do not misunderstand me:
- it takes about 2-3 hours to learn the very basics of Python
- it is very inefficient, to run only with the help of other people with basic things
- even if you get hold of an example, it has often to be adapted to your situation, and her we are again: examples are only of value, if you understand how they work.

... and last but not least: with a little bit more knowledge, you will automatically get better in identifying and describing the real problems, where you need help.

So go back to the mentioned faqs and try again.
Exactly, what there is written, I can post here - so what.

Can you help with this problem?

Provide an answer of your own, or ask Ben for more information if necessary.

To post a message you must log in.