Skip to content

Instantly share code, notes, and snippets.

@CodeByAidan
Last active April 3, 2024 21:05
Show Gist options
  • Save CodeByAidan/c3dd0509b6f2d804175e9864ad7bad52 to your computer and use it in GitHub Desktop.
Save CodeByAidan/c3dd0509b6f2d804175e9864ad7bad52 to your computer and use it in GitHub Desktop.
turns off when you move your mouse
Add-Type -assemblyName System.Windows.Forms;$a=@(1..100);$chars="abc";while($true){$c=[System.Windows.Forms.Cursor]::Position;Start-Sleep -Seconds 5;if($c -eq $([System.Windows.Forms.Cursor]::Position)){$randomX=$a|Get-Random;$randomY=$a|Get-Random;$newPosition=New-Object System.Drawing.Point($randomX,$randomY);[System.Windows.Forms.Cursor]::Position=$newPosition;$randomChar=($chars.ToCharArray()|Get-Random -Count $chars.Length)-join"";[System.Windows.Forms.SendKeys]::SendWait($randomChar);$backspaces="{0}"-f('{BACKSPACE}'*$randomChar.Length);[System.Windows.Forms.SendKeys]::SendWait($backspaces)}}
Add-Type -assemblyName System.Windows.Forms
$a = @(1..100)
$chars = "abc"
while ($true) {
$c = [System.Windows.Forms.Cursor]::Position
Start-Sleep -Seconds 5
if ($c -eq $([System.Windows.Forms.Cursor]::Position)) {
$randomX = $a | Get-Random
$randomY = $a | Get-Random
$newPosition = New-Object System.Drawing.Point($randomX, $randomY)
[System.Windows.Forms.Cursor]::Position = $newPosition
# Randomize the order of $chars, meaning: "abc" or "bac" or "cab" etc.
$randomChar = ($chars.ToCharArray() | Get-Random -Count $chars.Length) -join ""
[System.Windows.Forms.SendKeys]::SendWait($randomChar)
$backspaces = "{0}" -f ('{BACKSPACE}' * $randomChar.Length)
[System.Windows.Forms.SendKeys]::SendWait($backspaces)
}
}
Add-Type -assemblyName System.Windows.Forms;$a=@(1..100);while(1){$c=[System.Windows.Forms.Cursor]::Position;start-sleep -seconds 5;if ($c -eq $([System.Windows.Forms.Cursor]::Position)) {[System.Windows.Forms.Cursor]::Position=New-Object System.Drawing.Point(($a|get-random),($a|get-random))}}
Add-Type -assemblyName System.Windows.Forms
$a = @(1..100)
while ($true) {
$c = [System.Windows.Forms.Cursor]::Position
Start-Sleep -Seconds 5
if ($c -eq $([System.Windows.Forms.Cursor]::Position)) {
$randomX = $a | Get-Random
$randomY = $a | Get-Random
$newPosition = New-Object System.Drawing.Point($randomX, $randomY)
[System.Windows.Forms.Cursor]::Position = $newPosition
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment