Skip to main content

Hover-the-Mouse-over-the-Text

Command Description

Use Laiye Intelligent Document Processing to specify text identification within the Interface Element range, if you recognize that the specified text moves the cursor to the location where the text is located

Command Prototype

Mage.Hover(objUiElement,objRect,config,sText,sRule,iOccurrence,iTimeOut,optionArgs)

Parameter Description

ParameterRequiredTypeDefaultDescription
objUiElementTruedecorator@ui""Use mouse to select or cut off the target screen area including window, elements, range, etc
objRectTruedictionary{"x":0,"y":0,"width":0,"height":0}The range that needs OCR text recognition, the program will perform text recognition in this range of the control, if the range is passed as {"x":0,"y":0,"width":0,"height":0}, then Perform text recognition within the rectangular area of the control
configTrueexpression{}Call configuration of Laiye IDP
sTextTruestring""The text used for finding elements
sRuleTrueenum"instr"The rule used for finding text
iOccurrenceTruenumber1If the string in the Text field appears multiple times in the indicated UI element, specify the number of occurrences to click, for example, if the string appears 4 times and you want to click the first match, please Write 1 in this field
iTimeOutTruenumber30000Specify the time in milliseconds to wait for a retry to find the text. If exceeded, an exception will be thrown. Default: 30,000 milliseconds (30 seconds)
bContinueOnErrorNonebooleanNoneSpecify whether the automation should continue to support this field even if the activity is incorrect, it is only supported by the Boolean value (true, false) default value
iDelayAfterNonenumber300Delay time (in milliseconds) after executing the activity is 300 milliseconds
iDelayBeforeNonenumber200The delay time (in milliseconds) before any operations are executed is by default 200 milliseconds
sCursorPositionNoneenum"Center"Describes the cursor start point for adding offsets for the offsetx and offsety properties. The following options are available: topleft, topright, bottomleft, bottomlight, and center. The default option is center
iCursorOffsetXNonenumberNoneThe horizontal movement of the cursor based on the option in the "Position" field
iCursorOffsetYNonenumberNoneThe vertical offset of the cursor position based on the option selected in the "Position" field
sKeyModifiersNoneset[]Keyboard keys used while a mouse action is triggered: Alt, Ctrl, Shift, Win
sSimulateNoneenum"simulate"Available operation types are: Background Operation (uia), Simulated Operation (simulate), System Message(message). Default: Simulated Operation (simulate)

Demo

Dim objRect={"x":0,"y":0,"width":0,"height":0}  // Default recognition range 
Dim config={"Pubkey":"","Secret":"","Url":""} // Get from mage
Dim optionArgs={"bContinueOnError":false,"iDelayAfter":300,"iDelayBefore":200,"sCursorPosition":"Center","iCursorOffsetX":0,"iCursorOffsetY":0,"sKeyModifiers":[], "sSimulate":"simulate"} // Default optional parameters

TracePrint "--------------------Mouse over text--------------------"
// --------------------------------------------------------
// [Remarks] Move the mouse over the text
// Input parameter 1:
// objUiElement--target, in this example, the "Baidu click" button element used in chrome to open the Baidu homepage
// Input parameter 2:
// objRect--Recognition range. Default value: {"x":0,"y":0,"width":0,"height":0}
// Input parameter 3:
// config--mage configuration, need to configure Pubkey and Secret.Type:Dict
// Input parameter 4:
// sText--find text
// Input parameter 5:
// sRule--find rules
// Input parameter 6:
// iOccurrence--similar result position
// Input reference 7:
// iTimeOut--timeout time. Default unit: milliseconds. Type: Int
// Into reference 8:
// optionArgs--Optional parameters (including: error continue execution/delay after execution/delay before execution/cursor position/abscissa offset/ordinate offset/assistant key/operation type). Type:Dict

// 命令原型:Mage.Hover(objUiElement,objRect,config,sText,sRule,iOccurrence,iTimeOut,optionArgs)
// --------------------------------------------------------

Mage.Hover(@ui"Input control <input>_Baidu Yi 2",objRect,config,"Baidu Yi","instr",1,30000,optionArgs)