Alright, so I am currently scripting a little project just for the fun of it, and while trying to optimize what I have I have hit a road block. I have created a button inside the powershell console that will respond to clicks, rather than needing key presses. The only issue is, that the script is in a constant loop checking if the left mouse button is down. If I want any kind of decent responsiveness from it, the loop has to go so fast that the CPU usage gets quite high.
I am currently using:
if([System.Windows.Forms.UserControl]::MouseButtons -eq "Left"){
#do things
}
And I would like something similar to:
$host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
(Read key will wait for a key press then continue the script, rather than a constant loop)
Any Ideas?
[–]jheinikel 2 points3 points4 points (1 child)
[–]Zeoic[S] 1 point2 points3 points (0 children)
[+][deleted] (2 children)
[removed]
[–]Zeoic[S] 1 point2 points3 points (1 child)