2017-02-23 17 views
-1

類似於Ubuntu中的懸停點擊選項。思考無限while循環嵌套if else語句。如果鼠標正在移動,不需要點擊和休眠2秒鐘,否則鼠標左鍵點擊並休眠,直到鼠標再次移動。需要工作環境,所以Powershell將是最好的,如果可能的話。有人有主意嗎?謝謝!尋找一個鼠標左鍵autoclick腳本,可能爲Powershell

回答

0

這會將光標向前移動,每2秒向前移動一次&。

Add-Type -AssemblyName System.Windows.Forms 

do { 
    $pos = [System.Windows.Forms.Cursor]::Position 
    $pos.X--; $pos.Y--; [System.Windows.Forms.Cursor]::Position = $pos 
    Start-Sleep -Seconds 2 
    $pos = [System.Windows.Forms.Cursor]::Position 
    $pos.X++; $pos.Y++; [System.Windows.Forms.Cursor]::Position = $pos 
    Start-Sleep -Seconds 2 
} 
while ($true)