I have processes that automate desktop apps (Crystal Reports, Adobe Acrobat, Excel, etc.). These work fine when running in my main desktop session but when running in a PIP New Desktop session activities such as Click and Keyboard Shortcut will fail with the error: ‘UiPath.UIAutomationNext.Exceptions.UiAutomationException: Cannot bring the target application in the foreground. This action can only be performed when running in the main desktop.’ The applications are not running in the main desktop session when the project is running.
Are you using the Activate activity?
I do not have an Activate activity before the Click activity. I assumed that isn’t needed since the Activate property for the Click is set to True, and clicks are being executed fine when running in the main session. I tried adding an Activate activity before each Click and it still did not work in PIP.