once a while, when my script opens the application, it does not recognize the object because it finds the object name is different, for example the application name will have "MyApp_2" instead of "MyApp". It happens when somehow two of the same application are open or previous job was not killed properly. After rebooting my system will fix it, but I wonder if there is any workaround.
I searched in the forum, but I could not find. But it seems common error. any help would be appreciated.
if the issue is due to multiple instances , then you may use the ordinal identifier
Else, if its due to some unfinished job/processes from previous operations, then you can implement some function that would perform the required cleanup and call this function at the start of your script.