2016-04-15 227 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