Wednesday, June 22, 2022

Sikulix Similar

This is the third in the series of playing with RPA on a dynabook N40 with Ubuntu (lol). The sikulix editor is a great one that allows me to take screenshots and code as is. Sikulix editor I was even impressed by the convenience of this editor, as I have only programmed with vi for a long time back then (:-o).
After using sikulix for a while, I notice that there is a concept called "image accuracy". You might call it "recognition level". In other words, the logic is coded to click when the image saved in advance "matches" the actual screen, etc. This "match" is relatively "not exactly" (:-). Sikulix may click on a spot that is not even close to the humanly possible match, or conversely, they may be coldly told "Not found" even though the images should be exactly the same from human point of view. The need for this kind of fine-tuning is what makes sikulix a little different from other programming. The wonderful thing about sikulix is that this fine-tuning of "precision" can also be done from the editor. When you click on the cropped image, a window called "Pattern Settings" appears, with a tab called "Matching Preview". At the bottom, there is a slide bar that allows you to change the "Degree of Recognition". If you lower the "Recognition Level," the image will be judged as a "Match" if there is even a slight similarity, and if you raise the level, the image will be judged as a "Mismatch" even if there is only a slight difference. The need for fine-tuning in this area is typical of RPA, and there is a lot of room for ingenuity. I really respect those who are doing this for work, but not for fun. The result of such fine-tuning is as follows in python code.

click(Pattern("image.png").similar(0.90))

This means that the "recognition" is set to 90%. sikulix's editor is great, but it is a programmer's nature that once you get used to it, you will revert to editing this area directly in vi (lol).   By the way, you can fine-tune the position of the click on the image with the click() function by using "Target Offset" in the next tab. This can also be done with the mouse in the sikulix editor, but in coding, you can adjust it like this.

click(Pattern("image.png").similar(0.90).targetOffset(-275,20))

This one may be edited by vi directly... The following is the same sentence (:-).

Labels: , , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home