I'm attempting to create an autoclicker that can run in the background, or while other users use the computer and the account that the autoclicker is on is not logged off of (I'm using Windows 10)
I've tried running the script with administrative privileges. However, this still returns the same issue. I believe it may be an issue with Windows security and not powershell itself, however I do not know any other methods.
add-type -AssemblyName microsoft.VisualBasic
add-type -AssemblyName System.Windows.Forms
$wshell = New-Object -ComObject wscript.shell;
do {
[Microsoft.VisualBasic.Interaction]::AppActivate("Program")
[System.Windows.Forms.SendKeys]::SendWait("m");
start-sleep -Milliseconds 1050
} while ($true)
This is the output:
Exception calling "SendWait" with "1" argument(s): "Access is denied"
At C:\Users\me\Desktop\ASI.ps1:8 char:1
+ [System.Windows.Forms.SendKeys]::SendWait("m");
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : Win32Exception
Is there any method that can simulate key input, even if the desktop is locked?