Skip to main content

Wait-for-Image

Command Description

Wait for the image to show or hide

Command Prototype

Image.Wait(objUiElement,objRect,sImagePath,iAccuracy,iType,iTimeOut,optionArgs)

Parameter Description

ParameterRequiredTypeDefaultDescription
objUiElementTruedecorator@ui""When the attribute is transferred as a string, it is used as the characteristic string to find the interface element. When the attribute is transferred as UiElement, directly click on the corresponding interface element
objRectTruedictionary{"x": 0, "y": 0, "width": 0, "height": 0}Perform text recognition in the search area. If the area is passed as {"x":0,"y":0,"width":0,"height":0}, then the text will be recognized in the rectangle area of the control element
sImagePathTruepath'''C:\Users'''The path of the image to be found, generally in the res folder
iAccuracyTruenumber0.9Similarity to be used for finding images, ranging from 0.5 - 1.0, ie. similarity of 50% - 100%
iTypeTrueenum"show"The wait mode. It can be set to end after the image is displayed or after the picture disappears
iTimeOutTruenumber10000Specify the amount of time (in milliseconds) that wait for the event to run before selectorNotFoundException to trigger an error (in milliseconds) The default value is 10,000 ms (10 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
sMatchTypeNoneenum"GrayMatch"Specify a match type for an image. Gray-scale matching is fast, but it may fail in extreme situations. The color matching is more accurate, but the matching speed is slightly slower

Demo

TracePrint "--------------------waiting for image--------------------" 
// --------------------------------------------------------
// [Remarks] Waiting for the image, the Demo needs to use IE to open the URL below
// url: http://www.vrbrothers.com/cn/wqm/demo/pages/Demo-ComplexForm.aspx
// Input parameter 1:
// objUiElement--target element
// Input parameter 2:
// objRect--identification range
// Input parameter 3:
// sImagePath--find pictures
// Input parameter 4:
// iAccuracy--similarity
// Input parameter 5:
// iType--waiting mode
// Input parameter 6:
// iTimeOut--timeout time. Default unit: milliseconds. Type: Int
// Input reference 7:
// optionArgs--Optional parameters (including: error continue execution/delay after execution/delay before execution/activation window/matching method).Type:Dict

// : Image.Wait (objUiElement, objRect, sImagePath, iAccuracy, iType, iTimeOut, optionArgs)
// --------------------------------------------------------

Image.Wait (@ui "Yuguchi_www.vrbrothers.com/cn/wqm/demo/pages/Demo-Compl8", {"x": 0, "y": 0, "width": 0, "height": 0}, @ res "866e0590-ae65-11ec-896f-a79dc01a345c.png", 0.9, "show", 10000, {"bContinueOnError": false, "iDelayAfter": 300 , "iDelayBefore": 200, "bSetForeground": true, "sMatchType": "GrayMatch"})