Skip to content

Instantly share code, notes, and snippets.

@royashbrook
Created May 5, 2021 12:01
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/d5135adc58a09395da8989a789d866cb to your computer and use it in GitHub Desktop.
Save royashbrook/d5135adc58a09395da8989a789d866cb to your computer and use it in GitHub Desktop.
jiggles the mouse a little
#no idea why, but i thought this was kind of funny
#get our winform stuff
$null = [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
$null = [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
#move the mouse on x
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 )
}
#jiggle the mouse back and forth based on x offset
function Jiggle($offset){
while($true){
Start-Sleep -Milliseconds 10
Nudge ($offset = -$offset)
}
}
#jiggle....
"Jiggling..."
Jiggle 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment