After familiar with the basic concepts, let’s see what built-in features Blackey has. ⎝ (OωO) ⎠
In Hello Blackey !, we first briefly demonstrated the function of image search,
Now we will talk more about it.

Functions

Function Description
find(path) Given a path of an image, search whether it exist in current screen.
click(path)
dclick(path)
Given a path of an image, click the coordinates record in this image.
Even if the image does not exist on current screen, the coordinates will still be clicked.

find(path)

Input parameter: The relative path of the image

Return: If current screen exist this image, return 1; Else return 0.

The find function is often used with the IF-ELSE statement we mentioned earlier,
to achieve the behavior “Execute some actions if exist a certain image.”.

Here is an example:

if (find(“res/20190809-131033.png”)) {

print(“Image found!”);

} else {

print(“No image found”);

}

You can review the IF-ELSE statement in this previous article.

click(path), dclick(path)

Input parameter: The relative path of the image

Response: Click at the coordinate which record in the image,
even if there doesn’t exist this image on current screen,
The coordinate will still be clicked.

The coordinate will be record when Blackey captured the image in the Image Window.
So Blackey can still achieve click even if there doesn’t exist this image on current screen.
If you need to check the coordinates recorded by the image, you can load it in the Image Window.
The position with RED-cross is the coordinates which will be clicked.

You can just calling the click without any judgement:

click(“res/20190809-131033.png”);

Or, to check whether this image exist on current screen, then to click its’ coordinates:

if (find(“res/20190809-131033.png”)) {    

click(“res/20190809-131033.png”);

} else {

print(“No image found.”);

}

  • dclick(path): Same as click, but it will trigger double click.