Skip to main content
Version: v6.5.0

Screen OCR recognition

Command Description

Use the OCR identification screen to specify the range. When calling, you need to access the Internet

Command Prototype

sText = MicrosoftOCR.ScreenOCR(objElement,objRect,sUrl,sApiKey,iTimeOut)

Command parameter

parametermandatorytypedefault valueInstructions
objElementTruedecorator@ ui""Select or capture the target screen range that needs to be recognized through the mouse, including information such as windows, elements, and ranges
objRectTruedictionary{"x":0,"y":0,"width":0,"height":0}Specify the rectangular recognition range within the window where the target is located
sUrlTruestring""Please log in to Microsoft Azure, find Keys and Endpoint in the created computer vision resource, copy Endpoint and fill in
sApiKeyTruestring""Please copy the API Key from Keys and endpoints on Microsoft Cognitive Services
iTimeOutTruenumberthirty thousandSpecify the waiting time (in milliseconds) to retry the search for the screen range. If this time is exceeded, an exception will be raised. Default 30000 milliseconds (30 seconds), maximum timeout is 1000000 milliseconds

Return result

SText, Assign the result of running the command to this variable.

Run instance

/*********************************Screen OCR Recognition*************************************
Command Prototype:
sText = MicrosoftOCR.ScreenOCR(objElement,objRect,sUrl,sApiKey,iTimeOut)
Input Parameters:
objElement -- Target. Note: Select or capture the target screen area to be recognized via mouse, containing window, element, area information, etc.
objRect -- Recognition area. Note: Specify the rectangular recognition area within the target window.
sUrl -- Endpoint. Note: Please log in to Microsoft Azure, find the Keys and Endpoint in the created Computer Vision resource, copy the Endpoint, and enter it here.
sApiKey -- API Key. Note: Please copy the API Key from the Keys and endpoints section on Microsoft Cognitive Services.
iTimeOut -- Timeout (milliseconds). Note: Specify the wait time for retrying to find the screen area (in milliseconds). If this time is exceeded, an exception will be thrown. Default is 30000 ms (30 seconds), maximum timeout is 1000000 ms.
Output Parameter:
sText -- The variable where the output of the function call will be saved.
Notes:
None
********************************************************************************/
Dim sText = ""
sText = MicrosoftOCR.ScreenOCR(@ui"",{"x":0,"y":0,"width":0,"height":0},"","",30000)
TracePrint(sText)