Question


Cour Justice Européenne
LU
Last activity: 10 Apr 2025 10:29 EDT
SENDKEYS does not work
Function SENDKEYS does not work for unattended execution. This function was working correctly on an old VM but not on a new configured VM.
Screen saver has been disabled.
System.ComponentModel.Win32Exception (0x80004005): Access is denied at System.Windows.Forms.SendKeys.SendInput(Byte[] oldKeyboardState, Queue previousEvents) at System.Windows.Forms.SendKeys.Send(String keys, Control control, Boolean wait) at System.Windows.Forms.SendKeys.SendWait(String keys) at OpenSpan.Adapters.Windows.Window.SendKeys(String keys, Boolean focus) at OpenSpan.Adapters.Virtual.VirtualTargets.VirtualControl.SendKeys(String keys, Boolean focus) at OpenSpan.Adapters.Controls.Control.SendKeys(String keys, Boolean focus)
-
Reply
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Updated: 9 Jan 2025 12:22 EST


Pegasystems Inc.
US
@JeanChristopheD17042937 There is nothing specific about Pega Robotics or its install that would prevent or allow SendKeys to work. If your machine is locked, then SendKeys will not work as the keys will be sent to the lockscreen. If you are using the RPA Service, it will unlock the session when it logs in, although it is still possible for your machine to lock if that feature is not disabled on that machine.


Pegasystems Inc.
US
@JeanChristopheD17042937 Is there any other information you can provide? What is different about the VM? Does your automation work when you test it on your machine? Does it work on the VM when you are watching it? What is different about the VM when it doesn't work? What type of application are you using SendKeys with (Windows application, Edge or Chrome application, or a text/emulator application)?


Cour Justice Européenne
LU
Configuration of VM on which it runs :
Windows 10 Enterprise 22H2 OS build 19045.5011
Processor Intel Xeon Gold 6230
Configuration of VM on which it does not run :
Windows 10 Enterprise 22H2 OS build 19045.5011
Processor Intel Xeon Silver 4316
Is there a specific item in Windows or even in PEGA which could prevent SENDKEYS from running in unattended mode ?
Or is there a specific install component for PEGA to allow unattended robot ?
Accepted Solution
Updated: 9 Jan 2025 12:22 EST


Pegasystems Inc.
US
@JeanChristopheD17042937 There is nothing specific about Pega Robotics or its install that would prevent or allow SendKeys to work. If your machine is locked, then SendKeys will not work as the keys will be sent to the lockscreen. If you are using the RPA Service, it will unlock the session when it logs in, although it is still possible for your machine to lock if that feature is not disabled on that machine.


Cour Justice Européenne
LU
@ThomasSasnett Unattended Pega workflow is executed by Task Scheduler Windows.
SENDKEYS function receive a message "Acces denied".
There is no screensaver and deconnexion from VM is executed a way that allow session to be continued with same user.
How is it possible to investigate further more this problem ?


Pegasystems Inc.
US
@JeanChristopheD17042937When you test the automation while connected to this machine, does the process work? If so, it is likely that the screen is actually locking when you disconnect.


Cour Justice Européenne
LU
@ThomasSasnett Is it possible a screen is mapped in attended mode but not mapped in unattended mode ?


Cour Justice Européenne
LU
@ThomasSasnett Is it possible a screen is mapped when connected but not mapped when not connected ?


Pegasystems Inc.
US
@JeanChristopheD17042937Some applications don't actually draw their controls if the screen is locked. I believe WPF may do that. I have seen it with other apps for sure. It certainly is possible that the behavior of the application is different when the machine is locked since this isn't something the developer of the application would likely ever test for given that they are developing a UI for users to interact with (and obviously they cannot do that when they lock their screen). If you allow the RPA Service to start the process and run the automation, does it work then? It may be that when you disconnect from the VM using Remote Desktop, the workstation gets locked.