Skip to content

Instantly share code, notes, and snippets.

@Rio-Nyx
Created April 29, 2025 12:47
Show Gist options
  • Save Rio-Nyx/750b33440de3fe0570fa2a65f8f6c934 to your computer and use it in GitHub Desktop.
Save Rio-Nyx/750b33440de3fe0570fa2a65f8f6c934 to your computer and use it in GitHub Desktop.
Move mouse by 1 pixel in x coordinate and return back to original position
# Used to stop windows from sleeping
Add-Type -AssemblyName System.Windows.Forms
while ($true) {
$pos = [System.Windows.Forms.Cursor]::Position
# Move mouse slightly
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point(($pos.X + 1), $pos.Y)
Start-Sleep -Milliseconds 500
[System.Windows.Forms.Cursor]::Position = $pos
# Wait for 2 minutes
Start-Sleep -Seconds 120
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment