Run the bot for only one screen region

Hi, I’m a beginner… and I would like the bot to look for the image in a custom region of my screen. How could this be done?

Hi @josewilian ! Welcome to BotCity!
The find method can take parameters to limit the search area on your screen like this:

if not self.find("ok_button", matching=0.97, waiting_time=10000,
                 x=100, y=200, width=150, height=80):
    self.not_found("ok_button")

The code above will look for the ok_button on the a piece of the screen defined by:

  • x: the X coordinate of the start point of the search area
  • y: the Y coordinate of the start point of the search area
  • width: the width of the search area
  • height: the height of the search area

Which means that we will have a search area inside the rectangle (100, 200, 250, 280).

Let me know if this helps.

1 Like

don’t have any tool to capture the area with the mouse?

Not to define the sub area on the screen.
If you want to determine the area with other elements in the screen you can do that via code as well using the find with elements captured with BotCity Studio.

1 Like