Switch Window locking up program only while running Bot

Hello, I am working on a bot that will print a PDF from a program to use for audit purposes. The issue comes when trying to switch the window to the dialog box to input the file name. Most times, after hitting enter from the Print window that pops up, the program will lock up while trying to switch to the “Save PDF File as” Window. This only happens while running the bot. I can not replicate it while doing the process manually. I have tried using different ways to switch the window (Select an Open Window and Enter Window Title). I have also tried using a Wait before switching to the window. I have also tried using exception handling to try something else if it can’t switch to the window, but I do not believe that is working either as the program that I am trying to print from locks up. Any suggestions would be appreciated.

Hi @cteitsma what do you mean when saying the program locks up? Does the script get stuck on this step?

Thanks for replying! The script hangs on this step. It does not error out, so Exception handling does not work. It seems to be continuously trying to change to the window. The window it is trying to switch to is open, but grayed out and underneath the program that I am printing from. When it does work, it opens in the foreground and works correctly. It will go between working and not working with no change in code.

Here is a screenshot of how it looks when the bot hangs up.

I might have found the solution to this one in case anyone else is having the same problem. I found an old developer thread on another similar topic, and the answer there was to go into regedit and change the value of ForegroundLockTimeout under HKEY_CURRENT_USER\Control Panel\Desktop

1 Like