Dark mode needs no explanation. So lets focus on the new visionLimitSearchAreaByTextRelative command. Like its older sibling visionLimitSearchAreaRelative it can be used to restrict the search area for all following visual commands (XClick, XClickText, OCRSearch,…).
All …byTextRelative commands define the position relative to a word on the screen.
Example: In the video visionLimitSearchAreaByTextRelative| cross*#R-5,-10H22W150
defines the new search area as a box of height 22 and width 150 at the location -5,-10 relative to the word “cross*”. In the example “cross*” matches “cross-platform” on the website. If no height and width are used, the default values of H100 and W200 are used for the new area.
Hint: Use the “FIND” button on the IDE to test your parameters. Ui.Vision will draw lines and boxes around the location(s) it finds.
Demo macro (as used in the video):
{
"Name": "Demo Limit Vision",
"CreationDate": "2024-7-18",
"Commands": [
{
"Command": "open",
"Target": "https://ui.vision/rpa",
"Value": "",
"Description": ""
},
{
"Command": "OCRSearch",
"Target": "RPA",
"Value": "a",
"Description": "This searches the browser viewport for text"
},
{
"Command": "echo",
"Target": "a=${a}",
"Value": "cyan",
"Description": ""
},
{
"Command": "OCRExtractbyTextRelative",
"Target": "cross*#R-5,-10H22W150",
"Value": "text",
"Description": "This is not needed for the macro to work. We just use it here because it defines the text extraction area the same way as visionLimitSearchAreabyTextRelative defines the new search area."
},
{
"Command": "echo",
"Target": "text=${text}",
"Value": "yellow",
"Description": "Show OCR scraped text"
},
{
"Command": "visionLimitSearchAreabyTextRelative",
"Target": "cross*#R-5,-10H22W150",
"Value": "",
"Description": "Limit the search area"
},
{
"Command": "OCRSearch",
"Target": "RPA",
"Value": "a",
"Description": "Search again - now in new small area"
},
{
"Command": "echo",
"Target": "a=${a}",
"Value": "pink",
"Description": ""
}
]
}