Hey Abdelgawad,
Be sure to attach to the window you are planning to utilize the OCR click on first. For example, this can be done through the "
Launch and Attach" or the "
Find Window" commands.
The below sample script can be found on the
OCR Click documentation
defVar --name paintWindow --type Window
defVar --name paintImage --type Image
defVar --name clickedText --type String
defVar --name success --type Boolean
defVar --name clickRegion --type Rectangle
// Opens the Paint executable.
launchWindow --executablepath "C:\\Windows\\System32\\mspaint.exe" paintWindow=value
// Extracts the text contained in the informed control, using the Google Cloud Vision OCR provider.
ocrClick --ocrprovider "GoogleVision" --comparison "Contains" --segmentation "Word" --text View --occurrencetype "First" --language "eng" --region "5,3,42,20" --selector "Name" --name View success=success paintImage=image clickedText=text clickRegion=bounds
logMessage --message "Success: ${success}\r\nClicked Text: ${clickedText}\r\nClick Region: ${clickRegion}" --type "Info"
closeWindow --window ${paintWindow}
// The return varies according to the current execution context. In the case of this example:
// Success: True
// Clicked Text: View
// Click Region: 8,5,20,9
------------------------------
Martin Medina
Salient Process
------------------------------