Code Monkey home page Code Monkey logo

Comments (2)

RaiMan avatar RaiMan commented on May 24, 2024
  1. Use latest SikuliX (1.1.3 nightly)
  2. Read the docs - start here
  3. Ask such basic questions on Launchpad

Suggestion - if I understood your intention right

while True: # runs for ever
  if exists(image,0): # check if image is seen
    click() # click it if yes
  else:
    pass # do nothing when not found
  wait(1) # wait a bit before checking/clicking again
  # time can be adjusted

from sikulix1.

xfran1998x avatar xfran1998x commented on May 24, 2024

Thank you for your answer but isn't the problem.
The problem is that when sikulix can't find or click one image the script stops, I want that if can't click or find or wait for and image jump to the next lane code.

Example:

Click(image1)
Wait(image2,40)
Find(image3)

If I write this in case that image 1, 2 and 3 not appears the script stops, i want that in case that image 1 don't exists just jump to wait and if wait don't exists jump to find, etc. If its not possible just restart the script and start from 0 but still running the script.

I have the "if" sentence becouse i was trying to solve this problem but i don't know why sometimes (with mouse speed 0 and scan rate 0.1) the click after the if sometimes fails and stop the script.
Note: in the screen appear an image and I need to click it until desappears but fast. I write:

Mouse speed 0

while exists(image,0.3):
-----If exists(image,0.3):
-----------Click(image)

Mouse speed 0.5

Thats a bit strange becouse should be instant after the "if" exists to click the image, if the "if" exist 0.001 seconds before, the click should exists too but sometimes fails to find the click and stop it.

My knowleage of programing is like a beginer I learned c++ and a bit of python and I know only function, whiles and conditionals and vectors thats couse maybe I'm doing something wrong.

My script is whole write with whiles, ifs, click and waits. I always write "if" before a click and set the mouse 0 before the "if" and set it 0.5 when the while its over to prevent the error but maybe works 1h until click is not found and the script stops.

I wrote so much I think about my code and maybe the question is a bit confuse ^^. So know how it's my code the question is: if a "click" don't exists can I jump to the next lane code or start from 0 but the very important fact is not stop the script.

I can stop the script with the task manager if was necesary thats not a problem so i don't need to worry that the script stays 24/7 running and also all the script starts with a "while exists(image)" that i can make desappear to stop the script.

from sikulix1.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.