2016-04-15 224 views
3

就像我的问题,我该怎么办?我已经开始制作一个.bat文件,它将打开网站,现在我希望它将光标移动到屏幕的特定X'Y位置并左键单击。有没有一种方法可以在.bat或其他类型的脚本中执行?如何移动鼠标光标并单击?

由于提前, -Stam

+0

我认为这是不可能与现有的标准设置命令的批处理文件。您仍然可以使用批处理文件,但您可能需要使用其他脚本语言。我自己已经使用Python中的win32api模块完成了这个任务。你也可以检查我提到的可能的重复。 –

+0

如果因为工作原因无法安装第三方软件,PowerShell本身安装在Windows上,也应该可以执行此操作。 – SomethingDark

+1

如果您使用'InternetExplorer.Application' COM对象打开网站,则可以通过编程方式'DOMelement.click()'。 – rojo

回答

6

检查mouse.bat - 这是一个自我编译的C#/批处理文件,不需要外部工具和源是可见的,可编辑的。

例子:

//clicks at the current position 
call mouse click 

//double clicks at the current position 
call mouse doubleClick 

//right clicks at the current position 
call mouse rightClick 

//returns the position of the cursor 
call mouse position 

//scrolls up the mouse wheel with 1500 units 
call mouse scrollUp 150 

//scrolls down with 100 postitions 
call mouse scrollDown 100 

//relatively(from the current position) moves the mouse with 100 horizontal and 100 vertial postitions 
call mouse moveBy 100x100 

//absolute positioning 
call mouse moveTo 100x100 

//relative drag (lefclick and move) 
call mouse dragBy 300x200 

//absolute drag 
call mouse dragTo 500x500