autoit3 ie.au3 函数之——ControlClick

来源:互联网 发布:references 数据库 编辑:程序博客网 时间:2024/06/06 02:47

例子: 打开一个记事本,名字为、练习,修改内容

WinActivate("练习")

    ;以下为通过菜单打开退出选项

    Sleep(800)
    Send("!f")
    Sleep(800)
    Send("x")

    ;由于标题不同,这里需要注意,ControlClick的第三个参数是按钮的文本显示

    ControlClick("记事本","","取消")  

    ;此处为点击右键操作

    ControlClick("","","","right")



ControlClick详细介绍:

Sends a mouse click command to a given control.

ControlClick ( "title", "text", controlID [, button [, clicks [, x [, y ]]]] )

 

Parameters

titleThe title of the window to access.textThe text of the window to access.controlIDThe control to interact with. See Controls.button[optional] The button to click, "left", "right", "middle", "main", "menu", "primary", "secondary". Default is the left button.clicks[optional] The number of times to click the mouse. Default is 1.x[optional] The x position to click within the control. Default is center.y[optional] The y position to click within the control. Default is center.

 

Return Value

Success:Returns 1.Failure:Returns 0.

 

Remarks

Some controls will resist clicking unless they are the active window. Use the WinActivate() function to force the control's window to the top before using ControlClick().
Using 2 for the number of clicks will send a double-click message to the control - this can even be used to launch programs from an explorer control!

If the user has swapped the left and right mouse buttons in the control panel, then the behaviour of the buttons is different. "Left" and "right" always click those buttons, whether the buttons are swapped or not. The "primary" or "main" button will be the main click, whether or not the buttons are swapped. The "secondary" or "menu" buttons will usually bring up the context menu, whether the buttons are swapped or not.


ButtonNormalSwapped""LeftLeft"left"LeftLeft"middle"MiddleMiddle"right"RightRight"primary"LeftRight"main"LeftRight"secondary"RightLeft"menu"RightLeft


原创粉丝点击