← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #708157]: Want to continue with my Script when a counter on screen stops

 

Question #708157 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/708157

Amyjackson posted a new comment:
Hello,

It sounds like you're looking to create a SikuliX script that observes a
counter on your screen and clicks on a specific part of the screen every
second until the counter stops increasing. You can achieve this with
SikuliX by using image recognition and a loop to continuously check the
counter value. Here's a general outline of how to do this:

Import the necessary SikuliX libraries at the beginning of your script:
python
Copy code
import org.sikuli.script.*
Define the image or region where the counter is displayed and the location where you want to click. You can capture these images using SikuliX's built-in capture functionality.
python
Copy code
counterRegion = Region(x, y, width, height)  # Define the region where the counter is displayed
clickLocation = Location(x, y)  # Define the location where you want to click
Replace x, y, width, and height with the appropriate coordinates and dimensions for your specific application.

Create a loop that continuously checks the counter value:
python
Copy code
while True:
    counterImage = counterRegion.capture()  # Capture the current counter image

    # Implement logic to extract the counter value from the captured image.
    # You may need to use text recognition or image comparison to determine the value.

    # Check if the counter has stopped increasing (based on your logic).
    if counter_has_stopped_increasing:
        break  # Exit the loop

    click(clickLocation)  # Click on the specified location
    wait(1)  # Wait for 1 second before the next click
In the loop, you'll need to implement logic to extract the counter value from the captured image. Depending on the counter's appearance, you can use text recognition or image comparison techniques to determine the value.

After the loop exits, your script can continue with the rest of its tasks.
Remember to adjust the script according to your specific application's layout and the logic needed to detect when the counter stops increasing. SikuliX provides various image recognition and manipulation functions to assist you in achieving this task.

If you encounter any specific issues or have more detailed questions,
please provide additional information about the counter and its
behavior, and I can offer more tailored guidance.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.