nircmd - 强大windows命令行工具之鼠标操作
nircmd是windows一个强大小巧精悍的命令行工具;
这篇文章只介绍使用nircmd才完成操作鼠标常用的方法:
鼠标命名操作方法
sendmouse [right | left | middle] [down | up | click | dblclick] sendmouse [move] [x] [y] sendmouse [wheel] [Wheel Value] Sends the specified mouse event to the system. The operating system will behave exactly as the user really made the specified mouse action. Heres some example of sendmouse command: Sent a right click (For most applications, a context menu is opened): sendmouse right click Sent a double-click with the left mouse button: sendmouse left dblclick Press the left mouse button, move the mouse cursor 20 pixels left and 30 pixels down, and then release the button: sendmouse left down sendmouse move -30 20 sendmouse left up Scroll the mouse wheel 10 units in standard wheel mouse. (On standard wheel mouse, the wheel value should be a multiple of 120). sendmouse wheel 1200
这里结合vbs来调用nircmd举例:
鼠标定位:
Set sh = CreateObject("WScript.Shell") sh.run("nircmd setcursor x y", 0, true);
按下鼠标左键:
Set sh = CreateObject("WScript.Shell") sh.run("nircmd sendmouse left down", 0, true);
鼠标拖拽:注意鼠标拖拽要结合鼠标定位,按下鼠标左键,执行鼠标拖拽,抬起鼠标这一系列操作;
Set sh = CreateObject("WScript.Shell") sh.run("nircmd sendmouse move moveX moveY", 0, true);
抬起鼠标左键:
Set sh = CreateObject("WScript.Shell") sh.run("nircmd sendmouse left up", 0, true);
向下滚动鼠标滚轮:
Set sh = CreateObject("WScript.Shell") sh.run("nircmd sendmouse wheel -1000", 0, true);
更多命令,请查阅nircmd命令参考
http://nircmd.nirsoft.net/
相关推荐
吹云 2020-11-05
84407805 2020-11-01
曾是土木人 2020-10-31
87201442 2020-10-15
java0 2020-09-29
81437716 2020-09-18
81437716 2020-09-13
bluecarrot 2020-09-11
myCat 2020-09-09
83427718 2020-09-07
85560694 2020-09-03
89520991 2020-08-21
89550191 2020-08-09
katie000 2020-08-04
hunningtu 2020-07-30
89961330 2020-07-28
yuzhongdelei0 2020-07-28
yuzhongdelei0 2020-07-27