Question
Temporarily block user input
We have a long-running, attended process in a desktop application. It requires focusing fields and sending key strokes. If the user clicks or types anywhere on the screen, it can disrupt the automation. Even though people have been instructed not to do other work while the automation is running, we still find some people are trying to multitask.
Is there a recommended way to temporarily block user keyboard and mouse input while an automation is running? I found multiple code samples to accomplish this elsewhere and could add it in a script, but I suspect some of these methods would prevent automation from working. I only want to block the users input, not the automation input.
***Edited by Moderator Marissa to update SR Details***
In the past, I have a used a windows form that I set to border-less and display full screen. You make sure it to set to TopMost and it will then sit above any other applications. You can even set the opacity to a lower value so it is somewhat opaque. This may interfere with your SendKeys though, so you'd need to test it. You might also just use a similar approach but with a smaller screen displaying a message when the automation is running. This might remind the user to hold off on any tasks that might interfere.