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)
@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)?
@ThomasSasnett
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 ?
@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.
@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 ?
@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.
@ThomasSasnett
Is it possible a screen is mapped in attended mode but not mapped in unattended mode ?
@ThomasSasnett
Is it possible a screen is mapped when connected but not mapped when not connected ?
@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.
@ThomasSasnett
Screen is not locked.
But screen has a limited size when PEGA runs in unattended mode.
SAP does not display all items of a table but only 2 first items are readable.
SENDKEY (+){DOWN} must be applied to read next items but it seems no action is done.
Is it possible SENDKEY does not run correctly with SAP in unattended mode ?
@JeanChristopheD17042937I have not ever experienced an issue with an unlocked screen and SendKeys not working. I know some remote desktop software locks the screen when you disconnect. If you are not using the RPA Service, then whatever you’re using will more likely than not need to remain connected to the workstation as I know that Remote Desktop usually locks the screen when you disconnect. One thing you could verify is to connect to the machine and test it while you are watching. If it works then, that likely means it is actually locked and/or your desktop knows it isn’t connected and thus tells your applications that they do not need to load their UI as expected.