Skip to main content

Click-after-Intelligent-Recognition

Command Description

Click element after intelligent recognition

Command Prototype

UiDetection.Click(objUiElement,iButton,iType,iTimeOut,optionArgs)

Parameter Description

ParameterRequiredTypeDefaultDescription
objUiElementTrueexpression{}Select the recognized target of Computer Vision and the feature values of the anchor element
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}
iTimeOutTruenumber30000The amount of time to wait for command retries before "Find Target" throws an exception. Default: 30000 ms (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
bSetForegroundNonebooleanTrueWhether to activate the target window before executing
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

TracePrint("-------------------------- Click after intelligent recognition ----------------- ----------") 
//-------------------------------------------------------------------------------
//[Remarks] Use OCR to recognize the specified text within the window. If the specified text is recognized, click it, and you need to access the Internet when calling. (This command must be used together with the intelligent recognition screen range)
//Input parameter 1:
// objUiElement--Identifies the target. Note: Corresponding to the interface element that needs to be operated, when the attribute is passed as string type, it is used as a characteristic string to find the interface element, and when the attribute is passed as UiElement type, click directly on the interface element corresponding to UiElement
// iButton--mouse click. Note: mouse button {left: left button, right: right button, middle: middle button}
// iType--click type. Note: Click type {click: click, dbclick: double click, down: press, up: pop up}
// iTimeOut--timeout time. Note: Specifies the amount of time (in milliseconds) to wait for an activity to run before SelectorNotFoundException throws an exception. Default is 10000 milliseconds (10 seconds)
// optionArgs--Optional parameters. Note: This parameter is a number of optional parameters, including error continue execution, delay after execution, delay before execution, activation window, cursor position, abscissa offset, ordinate offset, auxiliary keys, operation type
//out parameters:
// None
// UiDetection.Click (objUiElement, iButton, iType, iTimeOut, optionArgs)
#icon("@res:38688e20-7f20-11ec-ab08-1d7b5faf0fee.png")
UiDetection.Click({"wnd":[{"cls":"Chrome_WidgetWin_1","title":"Click - 飞书云文档 - Google Chrome","app":"chrome"}],"cv_engine_version":1,"cv_region":{"x":0,"y":0,"width":0,"height":0},"cv_descriptor":{"anchors":[{"cls_type":100,"height":41,"text":"Click","width":89,"x":584,"y":225}],"confidence":0.800000011920929,"cv_handle":"\"2b3223b0-7f20-11ec-ab08-1d7b5faf0fee\"","match_version":1,"target":{"cls_type":100,"height":41,"text":"智能识别后点击","width":205,"x":584,"y":296}}},"left","click",30000,{"bContinueOnError":false,"iDelayAfter":300,"iDelayBefore":200,"bSetForeground":true,"sCursorPosition":"Center","iCursorOffsetX":0,"iCursorOffsetY":0,"sKeyModifiers":[],"sSimulate":"simulate"})