So I have two systems. When I sign into them the windows are identical, there is not a single unique selector.
I have been using the ApplicationWindow parameter inside of the Attach Window activity.
When you assing a variable to ApplicationWindow the variable will get an unique handle.
This has all worked good for a long time. But last week the systems started to be slow or act “strange” from before and the ApplicationWindow in the 2nd system the robot signed into
did not get an unique handle. the handle number now was exactly the same as in the 1st system. This made the REF-process do everything in system 1 only.
I have now implemented an IF activity that checks if the handles are identical or not. If they are identical it throws an error.
My questions:
What is the best way to handle exceptions with ApplicationWindow and if they dont get their unique handle, is it the way I did it the best or is there a different way?
How does Studio(UiPath) focus windows when they are multiple windows that are exactly the same. How can I be sure that ApplicationWindow doesnt “overwrite” the handle?
Because when the system first starts there is no unique way to distinguish them.
Example:
Two identical notepad windows.
How does studio know what window to focus on before it has assigned an unique handle?
Is it the last focused window and if it is like that, how does the focus work in depth?
What is the best way to handle exceptions with ApplicationWindow and if they dont get their unique handle(“window variable”), is it the way(see above/topic start) I did it the best or is there a different way?
How does Studio(UiPath) focus windows when they are multiple windows that are exactly the same. How can I be sure that ApplicationWindow doesnt “overwrite” the handle?
Because when the system first starts there is no unique way to distinguish them.
Example:
Two identical notepad windows.
How does studio know what window to focus on before it has assigned an unique handle?
Is it the last focused window and if it is like that, how does the focus work in depth?
When two windows will have the same descriptive labels (e.g. the Window Title) so e.g. an Attach window will take the first found one.
internaly it is differentiated.
Thats why we are working in a scenario described above with the window variables.
Internally the window variable has a property e.g. Handle and can be used for the differentation.
Also we can create the window variable with the Handle (e.g. retrieved from the Windows.Process)
new Window(Process.GetProcessesByName(“notepad”).First().Handle) ← Line is for explanation and not for usage without exploring the topic in advance
Robot opens “program 1” → attach window → gives it a unique handle(output)
Robot opens “program 2”(exactly the same as “program 1”) → attach window → gives it a unique handle(output).
The robot cant mistakenly focus on program 1 in step 2?
Note that program 1 and program 2 are open constantly during the process.
I guess the system is smart and knows which program/window it is working with currently even if the programs/windows are exactly the same. Otherwise this would not work at all.
Maybe this is what you said: “internaly it is differentiated.”