Attach after exception?

riderc1

Member
The Win32 application I am automating sometimes has odd behavior. In my Blue Prism process, I am using exception handling to deal with the issues. When a problem is detected, normally just doing a retry on the same application works and is not a repeatable problem.

The application is launching Internet Explorer for part of the process. When the exception is encountered, I update the queue with ExceptionDetails(). On the subsequent retries, ExceptionDetails() is reporting it could not identify the process owning the current foreground window.

To further explain my loop/logic:
1. Launches Win32 app.
2. Gets data from Blue Prism work queue (already populated). If there is no work, end. If there is work, go to step 3.
3. Clicks a few buttons in the Win32 app. This causes Internet Explorer to launch. It then does a few more things in Internet Explorer before it ends. After its done, it closes Internet Explorer. It goes back to step2 (and will relaunch Internet Explorer).
If something happens in step 3, the exception handled catches it and updates the queue. It then ends Internet Explorer and returns to step 2. Step 2 will relaunch IE.

Should my exception handling block do an attach to the Win32 app? I'm going to try it out, but the problem is not easily repeatable and I may not catch it. If you try to attach while already attached, this causes an exception. (Might just wrap this in a block and handled the exception.)
 

LeoLugo

Member
You can set a Read stage to check if the Win32 app is already connected. If it isn't then connect. If it's connected just continue. You can also use Activate Application to make sure the app has focus before you proceed.
 
Top