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
------------------------------
Original Message:
Sent: Sun December 11, 2022 03:36 AM
From: abdelgawad elsayed
Subject: OCR issues
hello all ,
I have a problem using "OCR" command with returning error message
Error executing command at line 19: ocrClick --safesearch --ocrprovider "Abbyy" --comparison "Contains" --segmentation "Word" --text "Sign in" --occurrencetype "Last" --language "en-US" --selector "XPath" --xpath "/root/document[1]/button[1]"
Exception of type 'WDG.Automation.Windows.WindowNotAttachedException' was thrown.
Can anyone please help me to kill this issues
Best Regard,
Abdelgwad
------------------------------
abdelgawad elsayed
------------------------------