Hi Vinicius
When using the command 'waitImage' with 'Search on Screen' enabled, the command searches the image on the entire screen, when disabled it searches only the window that is in context.
What I can see in your code is that you are looking for an image with the text 'Windows (CRLF)' with a gray background. I don't know if there was this text on the test screen, if so, it can decrease the similarity a little, to see if it gets more accurate.
Another way to search for an image limiting the search area is the command 'FindImage', it returns to the position of the screen where the image is and with the command 'Mouse Command' you can click. But the findImage command has no time limit, so it will not search for whether it exists or not, it will only validate once.
Some notes on working with image:
- The resolution of the development machine with the production machine, both have to be the same
- The smaller the image, the faster its location
- If I managed to map the region of the image, with a color that has little on the screen, it is faster too.
------------------------------
Angelo Alves
------------------------------
Original Message:
Sent: Fri April 09, 2021 03:19 PM
From: Vinicius Marques
Subject: Defining Region in Wait for Image commands
Hi,
I've been trying to understand how to limit the area the robot should look for an image without success. No matter how I tried it, if I don't select to search in the entire screen, it does not work. Has anyone made this work? Here is a sample script comparing the two "methods", which is searching the entire screen and limiting a region (using the rectangle from the window object itself).
import --name image1 --type "Image" --content iVBORw0KGgoAAAANSUhEUgAAAFcAAAAMCAYAAAAXgSFYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAN4SURBVFhH3Vc9bqtAEP6SE/gMxJIlSgpugF24onBPiZvIDQUnoHBjucElfQoqCpsbUFAiITk+AzfIm1mGP//ESfSS95RPQvbOetmdb2a+HT+8OHhL5hU2FgQpVqM1JvkBS60xrTBK5qiej5gaMez+3Idw5Z3fjFM4hVF6qFrHTginBvxMhmaA/LCEps62QCRmhvPS8HHr3JdrzCCHVxpYT3Ic5MeP1txBlKRqoHA6okCGeH8SA5sKmJMnQFviUP0cQV/GKYQb28gbYmk8HRkovQpVJc8O2LdumwhysVO2RYsV0XcPvTX0MKHWJocduwiFukc8TWAWR4prjdM+hh4EQPnaWEAm2LP/ndEO7AMdmLJSjRC6PvQ2GwWUKMv+uIE1h0Ppdexy6xPQsPR0+Ns6NI/QZrARo07UmsjJbAw9SiR6rygzHWN1Ui6HqURGvockGaOReqZNyBgqWxr7UYyC3hw/K0mTdNV9H+5F4DVqksv7cm2Hs2Q47RFnDubXiLyGNEFk2vhyLvWS9ZHZHuuZJCoRSVTPNAtzR6LHmzlzXD9bBr8kLZZyyvytBISIMeps4bkdBa/Tp+FclQcoFjWJA4mifQsTrTypbGRpSrfw9Ze2HAfZqNBPBoE5Aa18B+SHIQHju0Vp8T301vSDrFFiZiWdQpHbc4qJ1MfqxRQA5Virt1dBuvMs3vXLiXWbLoxmSlt6NCdQmt7LJCpPz5Hg9qKeJgVsz+ZD0LiXjfybaDGsknsQZ29D9JMCbbYVew9Dze2C/ISJWfOgyG2cSolIR7zWZuRYuf9ZvW0lKkVSUAVZPCZiuLRVRfFv+FLlanBvyMIZ+J1mhP6dfRP07l1QYP2ZwF2gq5yaXOWUj4VfV15tY931qXU5K7GPQJWGD9F1kst1Jws8R6PWWdLSddRksgaOaeyuUagLiccFkm3Zu6BqaMsD8sBEcXHzdJlTgy8Z7gDOAkH7hlcI5yrT/e7G/zRU1dYyVJOrnCCBGwg56y593NTb92Bho1qaWo9cCl0rCzyndFb0SvXNm3YPVTHUizbVwuMiIoloDsY9t+ic4evwLvpCCVCvlaQeSbRd9uTHBVWGzA9g4ZmaJd8NlTyda+tdOXotkYm0PpBevNXWXwTuLIi83Ycupr8J7mTUxuq/wO8kl3D5D+37wa3kAtTJyJ6/ltx/D+APaWreeC7YT5gAAAAASUVORK5CYII=defVar --name window --type WindowdefVar --name successWaitImage --type BooleandefVar --name successWaitImageRegion --type BooleanlaunchWindow --executablepath "notepad.exe" window=valuewaitWindow --classname Notepad --processname notepadfocusWindow --window ${window}waitImage --searchonscreen --image ${asset.image1} --similarity 100 --timeout 00:00:10 --interval 00:00:01 --selector "Vision" --comment "With Search on Screen" successWaitImage=successwaitImage --image ${asset.image1} --similarity 100 --timeout 00:00:10 --interval 00:00:01 --region "${window.Bounds}" --selector "Vision" --comment "With Region" successWaitImageRegion=successcloseWindow --window ${window}logMessage --message "Success without region: ${successWaitImage}\r\nSuccess with region: ${successWaitImageRegion}" --type "Info"
Any help is much appreciated.
By the way, if anyone has information/guides/tutorials on how to use computer vision commands with IBM RPA (useful if working with VDI, Citrix, and others), it would be great if you shared. Everything I could find was a short video on YouTube, not even the Learning Journey has something about it.
------------------------------
Vinicius Marques
------------------------------