MouseClick
执行鼠标点击操作.
MouseClick ( "button" [, x, y [, clicks = 1 [, speed = 10]]] )
参数
button
|
The button to click:
$MOUSE_CLICK_RIGHT ("right") = 右键
$MOUSE_CLICK_MIDDLE ("middle") = 中键
$MOUSE_CLICK_MAIN ("main") = 主要
$MOUSE_CLICK_MENU ("menu") = 菜单
$MOUSE_CLICK_PRIMARY ("primary") = 主键
$MOUSE_CLICK_SECONDARY ("secondary") = 次键
常量定义在 "AutoItConstants.au3"
|
x, y
|
[可选] 点击目标的 X/Y 坐标值. 若两者都留空, 则使用当前位置(默认).
|
clicks
|
[可选] 鼠标按钮点击的次数. Default(默认) = 1.
|
speed
|
[可选] 鼠标移动速度. 可设数值范围在 1(最快)和 100(最慢)之间.
若设置速度为 0, 则立即移动鼠标到指定位置. Default(默认) = 10.
|
返回值
成功:
|
返回 1.
|
失败:
|
返回 0, 按钮不在列表中, 或者使用了无效的参数.
|
备注
如果"按钮"参数值为空, 则使用左键点击.
如果 x 或 y 坐标设置为关键字 Default 则相应坐标位置不会发生移动.
若用户通过控制面板切换了鼠标左右按钮, 则按钮操作将有不同的行为.
无论是否交换了按钮, "Left"(左键) 与 "right"(右键) 总是点击操作;
"primary"(初级) 或 "main"(主) 按钮为主点击;
"secondary"(次级) 或 "menu"(菜单) 按钮通常将会触发上下文菜单.
Button
|
Normal
|
Swapped
|
""
|
左键
|
左键
|
"left"
|
左键
|
左键
|
"middle"
|
中键
|
中键
|
"right"
|
右键
|
右键
|
"primary"
|
左键
|
右键
|
"main"
|
左键
|
右键
|
"secondary"
|
右键
|
左键
|
"menu"
|
右键
|
左键
|
函数示例
#include <AutoItConstants.au3>
; Double click at the current mouse position.
MouseClick($MOUSE_CLICK_LEFT)
MouseClick($MOUSE_CLICK_LEFT)
; Double click at the x, y position of 0, 500.
MouseClick($MOUSE_CLICK_LEFT, 0, 500, 2)
; Double click at the x, y position of 0, 500. This is a better approach as it takes into account left/right handed users.
MouseClick($MOUSE_CLICK_PRIMARY, 0, 500, 2)
----------------------------------------
该函数可以通过命令调用 exect
参见:
ControlClick, MouseDown, MouseUp, MouseClickDrag, MouseCoordMode (Опция), MouseClickDelay (Опция)
exect=MouseClick('left',0,500,2) ;; 双击坐标x = 0,y = 500
© Аверин Андрей для Total Commander Image Averin-And@yandex.ru
|