Loop with key break

Asked by Peter Darbyshire

I have a very simple script which

Clicks a image
Waits for a image
Clicks a image
Wait for a image

It works perfectly i was wondering if there is any way loop this script and to start / stop this script for example using a F1 Key.

Can this be done or at least just loop and stop the script.

Thanks for help

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
eliteSKL (camaro70s) said :
#1

http://sikuli.org/docx/faq/000-can-i-do-xxx.html

while True:
      Clicks a image
      Waits for a image
      Clicks a image
      Wait for a image

for x in range(100):
      Clicks a image
      Waits for a image
      Clicks a image
      Wait for a image

x=0
while x !=100:
      x+=1
      Clicks a image
      Waits for a image
      Clicks a image
      Wait for a image

import time
while time.ctime()[11:16] < "16:30": #loop untill 4:30pm
      Clicks a image
      Waits for a image
      Clicks a image
      Wait for a image

Revision history for this message
eliteSKL (camaro70s) said :
#2

the last one is not correct... it works. but i believe it to be an incorrect solution. because your comparing an object to a string. or a string to a string.

anyways i believe the correct way would be some where along the lines of

while ((datetime.datetime.now.hour,datetime.datetime.now.minutes)<(some sort of time object/convertion , some sort of time object/convertion)):

anyways disregard the las while time.ctime() method loop.

either way i don't think i have that last one quite right. but you can stop it by the time of day too. just have to read up on it more.

Can you help with this problem?

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

To post a message you must log in.