I'm working on a small proj in Blueprism, on mspaint.exe to draw few schematics. As BP allows us to switch between similar attached apps, I want to switch from first window to second window of mspaint. But as both are not saved with any file-name, the windows text is "Untitled - Paint" for both.
In Blueprism, when there are more than 1 instances open for an exe, all with same window title, cannot attach to any open instance.
Tried attaching with exact or wildcard match as well as child-index selection (any one of them + process name in nav. stage), all open instances respond true. I think that, there is no instance number given by the exe (mspaint) to OS, so that BP can identify it.
In Navigation stage, giving the child-index, is giving exception :
"More than one application matched the criteria".
If title is same and child-index is unobtainable, what is the usual way to attach a window? Is there any method to get the unique window-handle and use it?
you can attach to a target application via PID in your attach stage. Doing it this way is very very tricky and will make for a cumbersome process so though yes you can do it, I'd really re-visit your design and make sure you're doing the right design choices.
The image here is a quick schematic I drew up which does what you're looking for. you can launch the application with utility environment launch process and proivde it the path to the target application usually
once launched you can then identify the PID of each instance and attach to them. When you attach make sure you control your detach/attach decisions as an object can only attach to one instance at a time so either have a seperate object to circumvent this or have your actions have very structured well-defined criteria to manage attach and detaching constantly in your process as you switch between two applications.
the XML code to do the image is here, please read the notes. There is also a sample attach stage (with a purposeful error in it). You should be able to step through the other code easily enough. Just copy paste it into your diagram area.