Skip to content

Tego Bot API Documentation v0.2.0


Tego Bot API Documentation / findAllOnScreen

Function: findAllOnScreen() ​

findAllOnScreen(template, config?): Promise<MatchResult[]>

Defined in: botjs/src/image-match.ts:259

Find all matches of template image on screen

Parameters ​

template ​

ImageResource

ImageResource to search for

config? ​

MatchConfig

Optional matching configuration

Returns ​

Promise<MatchResult[]>

Promise resolving to array of MatchResults, sorted by confidence descending

Example ​

typescript
import { imageResource, findAllOnScreen, moveMouse, mouseClick } from "@tego/botjs";

const icon = await imageResource("./checkbox.png");
const matches = await findAllOnScreen(icon, { confidence: 0.7, limit: 10 });

console.log(`Found ${matches.length} checkboxes`);

// Click each checkbox
for (const match of matches) {
  const center = getMatchCenter(match);
  moveMouse(center.x, center.y);
  mouseClick();
  await sleep(100);
}

Released under the MIT License.