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

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -