windows - powershell mouse move does not prevent idle mode -
before start, here first little code wrote in powershell :)
[system.windows.forms.cursor]::position = ` new-object system.drawing.point($pos.x, ($pos.y - 1)) [system.windows.forms.cursor]::position = ` new-object system.drawing.point($pos.x, $pos.y)
what want achieve?
well, want move mouse cursor every 4 minutes prevent screensaver appearing (every second in code above testing). code move mouse every time 1 pixel , down immediately. thing is, screensaver (or idle mode of windows) still appearing.
now, learning powershell , have little experience windows architecture.
does see mistake? appreciate answer lot! :d in advance.
the solution blog prevent desktop lock or screensaver powershell working me. here relevant script, sends single period shell:
param($minutes = 60) $myshell = new-object -com "wscript.shell" ($i = 0; $i -lt $minutes; $i++) { start-sleep -seconds 60 $myshell.sendkeys(".") }
and alternative comments, moves mouse single pixel:
$pos = [system.windows.forms.cursor]::position [system.windows.forms.cursor]::position = new-object system.drawing.point((($pos.x) + 1) , $pos.y)
Comments
Post a Comment