Image OCR recognition
Command Description
OCR identification of the specified image requires access to the Internet when calling
Command Prototype
sText = OCR.ImageOCR(sFileName,sEngine, sAcessKey, sSecretKey, iTimeOut)
Command parameter
parameter | mandatory | type | default value | Instructions |
---|---|---|---|---|
sFileName | True | path | ''' C:\Users''' | The image path to be recognized |
sEngine | True | enum | "baidu1" | OCR engine used for text recognition |
sAcessKey | True | string | "" | ApiKey for OCR Services |
sSecretKey | True | string | "" | Secret Key for OCR Service |
iTimeOut | True | number | ten thousand | Specifies the amount of time (in milliseconds) to wait for the Activity to run before the SelectorNotFoundException throws an exception. The default value is 10000 milliseconds (10 seconds) |
Return result
SText, Assign the result of running the command to this variable.
Run instance
/**************************Image OCR Recognition**************************
Command prototype:
sText = OCR.ImageOCR('C:\\Users\\', "baidu1", "", "", 10000)
Input parameters:
sFileName -- Location of the recognition file. Note: Path of the image to be recognized.
sEngine -- OCR engine. Note: OCR engine used for text recognition.
sAccessKey -- Baidu OCR engine ApiKey. Note: ApiKey for OCR service (need to register OCR account and create application to get this parameter).
sSecretKey -- Baidu OCR engine SecretKey. Note: SecretKey for OCR service (need to register OCR account and create application to get this parameter).
iTimeOut -- Timeout. Note: The amount of time (in milliseconds) to wait for the activity to run before SelectorNotFoundException is thrown. The default value is 10000 milliseconds (10 seconds).
Output parameters:
sText -- The variable where the output of the function call is saved.
Notes:
1. This command calls the external Baidu OCR interface. You need to create a Baidu OCR account and corresponding application in advance, and obtain the corresponding Access Key and Secret Key of the application.
2. Ensure that the window for OCR operation exists; otherwise, the command execution will report an error.
3. An external network connection is required to run this command.
******************************************************************/
Dim sText = ""
sText = OCR.ImageOCR(@res"1643099897(1).jpg","baidu1", "P10qsjDcuoN5ZU7dnSHmXzGh", "Fm8whYrNnXtKkSvqVPUYL573XfNbxlmO", 10000)
TracePrint(sText)