Skip to content

Instantly share code, notes, and snippets.

@royashbrook
Created April 13, 2021 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save royashbrook/18c9bd86087c6be9eeb6fd8e06d72161 to your computer and use it in GitHub Desktop.
Save royashbrook/18c9bd86087c6be9eeb6fd8e06d72161 to your computer and use it in GitHub Desktop.
Jiggle the mouse
#moves the mouse x location by offset p pixels
function Nudge($p){
[System.Windows.Forms.Cursor]::Position = `
[System.Drawing.Point]::New( `
[System.Windows.Forms.Cursor]::Position.X+$p, `
[System.Windows.Forms.Cursor]::Position.Y )
}
#call nudge every 10ms with pos/neg value of x
function Jiggle(){
$x = 1
while($true){
Start-Sleep -Milliseconds 10
Nudge ($x = -$x)
}
}
#jiggle the mouse...
"Jiggling..."
Jiggle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment