Before I start, here is my very first little code I 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 do I want to achieve?
Well, I want to move the mouse cursor every 4 minutes to prevent the screensaver from appearing (every second in the code above for testing). The code does really move the mouse every time one pixel up and then down immediately. The thing is, the screensaver (or idle mode of windows) is still appearing.
Now, I am learning PowerShell and I have little experience with the Windows architecture.
Does anybody see my mistake? I would appreciate an answer a lot! :D Thanks in advance.
Try this: (source: http://just-another-blog.net/programming/powershell-and-the-net-framework/)
I've added a notification that you can easily enable / disable just setting its variable to $true or $false. Also the mouse cursor moves 1 px right and then 1 px left so it basically stays in the same place even after several iterations.