We have been discussing (checking if window exists before performing actions on it - post) about using tpAttachNoWait option.
We have two options of using it.
1. Use tpAttachNoWait flag with the object and invoke "attach" method - to see if the object exists and can be brought into focus. If it returns true then go ahead and attach it without tpAttachNoWait flag
2. Other way is use tpAttachNoWait flag with the object and invoke "exists" method if it returns true then go ahead and attach it without tpAttachNoWait fiag.
Both of these can be used to check if object exists and can be "attached" - But not sure which one is "fool proof".
As per TP documentation - use first option - that means do a dummy attach to see if object exists.
I am not sure if there is a difference between "exists" and "attach" response when used with tpAttachNoWait flag
tpAttachNoWait with attach works for an object that does not exit or not in focus.
Pl. refer bellow TP documentation of tpAttachNoWait
Performs the attach without waiting. This suppresses the exception handling and the referred instance of the object receiving the result of the construction function can be validated using the Exists property.
Now it appears to me that using .exists with tpAttachNoWait for checking if the object can be attached when object is may or may not be in focus - IS the correct method to use ...