Skip to main content

Click-Text

Command Description

Use Laiye IDP to recognize text in the window. If texts are recognzied, then they will be clicked

Command Prototype

Mage.Click(objUiElement,objRect,config,sText,iRule,iOccurrence,iButton,iType,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
iRuleTrueenum"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
iButtonTrueenum"left"Mouse button {left: Left button, right: Right button, middle: Middle button}
iTypeTrueenum"click"Click type {click: single click, dbclick: double click, down: keydown, up: keyup}
iTimeOutTruenumber30000Specify the waiting to try to find the screen range time (in milliseconds), if this time is exceeded, the error is raised by default 30000 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 click text--------------------"
// --------------------------------------------------------
// [Remarks] The mouse clicks on 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:
// iRule--find rule
// Input parameter 6:
// iOccurrence--similar result position
// Input reference 7:
// iButton--mouse click
// Into reference 8:
// iType--click type
// Input reference 9:
// iTimeOut--timeout time. Default unit: milliseconds. Type: Int
// Input parameter 10:
// 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.Click(objUiElement,objRect,config,sText,iRule,iOccurrence,iButton,iType,iTimeOut,optionArgs)
// --------------------------------------------------------

Mage.Click(@ui"Input control<input>_Baidu one 1",objRect,config,"Baidu one","instr",1,"left","click",30000,optionArgs)