Keeping your remote session active when using Runner
In some cases where a VM is used to run the automation, keeping the remote session active is necessary to avoid problems with the graphical interface, such as the OSError: screen grab failed error. This error is usually thrown when trying to perform an automation that uses computer vision to find elements in an environment where the remote connection has already been closed. This is because when closing the connection, the operating system will make the screen black, preventing bots from capturing the screen and making it impossible to search for graphic elements.
For this, BotCity offers two scripts to run bots that use the graphical interface of the environment without having to be connected to the session. These scripts disconnect the user's current session and redirect it to a terminal session, keeping the session and graphical interface active for BotCity Runner.
These scripts are available within the BotCity Studio SDK folder and can be used in the Runner execution settings. You can choose to execute them by starting the Runner using the startup parameter or before each task that the Runner will perform through the beforeTask parameter.

Available Scripts:
startup.bat: This script is available in the startup folder, and by setting it in the Runner configuration file, it will disconnect the current session and redirect it to a terminal session.
console_session.bat: This script is available in the scripts folder, and by setting it in the Runner configuration file, it will also have the function of disconnecting the current session and redirecting it to a terminal session, but also has the option to define the screen resolution for this new session.

Important:
After configuration, you must start Runner with administrator privileges for the scripts to run.
Related Articles
"Session Not Found" Error When Using a Startup Script to Disconnect User Sessions
Issue Description When using a startup or logout script to disconnect user sessions on Windows, some users encounter the following error: Session not found This usually happens when the username contains spaces, for example: USER NAME In such cases, ...
Troubleshooting when using ‘Print Screen’ in BotCity Studio
In some sporadic cases, when using the 'Print Screen' key to take a screenshot, the captured image is not displayed in Studio. This behavior may be related to several factors, such as other applications intercepting the 'Print Screen' action, ...
What to do when Runner seems stuck when executing a new task?
In sporadic situations, the Runner may seem stuck after pulling a new task for execution. In this situation, the execution is not started, and the Runner status remains as Executing task ... until the Runner is restarted. Overall, the resources used ...
Resolving SSL certificate verification issues when running commands using 'pip'
Access blocks are quite common in corporate environments. As a result, you may encounter problems when trying to use BotCity tools and Python resources on a machine in your company's environment. One problem that may occur in these scenarios is the ...
Best Practices for Using BotCity Windows Inspector
Introduction When developing automations with the BotCity Windows Inspector, following certain best practices can significantly improve your experience and results. Below are key recommendations and important points to consider during development. ...