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
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
objUiElement | True | decorator | @ui"" | Use mouse to select or cut off the target screen area including window, elements, range, etc |
objRect | True | dictionary | {"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 |
config | True | expression | {} | Call configuration of Laiye IDP |
sText | True | string | "" | The text used for finding elements |
iRule | True | enum | "instr" | The rule used for finding text |
iOccurrence | True | number | 1 | If 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 |
iButton | True | enum | "left" | Mouse button {left: Left button, right: Right button, middle: Middle button} |
iType | True | enum | "click" | Click type {click: single click, dbclick: double click, down: keydown, up: keyup} |
iTimeOut | True | number | 30000 | Specify 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) |
bContinueOnError | None | boolean | None | Specify 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 |
iDelayAfter | None | number | 300 | Delay time (in milliseconds) after executing the activity is 300 milliseconds |
iDelayBefore | None | number | 200 | The delay time (in milliseconds) before any operations are executed is by default 200 milliseconds |
sCursorPosition | None | enum | "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 |
iCursorOffsetX | None | number | None | The horizontal movement of the cursor based on the option in the "Position" field |
iCursorOffsetY | None | number | None | The vertical offset of the cursor position based on the option selected in the "Position" field |
sKeyModifiers | None | set | [] | Keyboard keys used while a mouse action is triggered: Alt, Ctrl, Shift, Win |
sSimulate | None | enum | "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)