When using DOR (Dynamic Object Recognition) statements, SilkTest must first find the control described by the "XPath" query before it can execute the method specified. Therefore if SilkTest fails to find the window described by the XPath query, the "Could not find Object" error will be raised as it will be unable to execute the associated method.
 
To prevent the said error from occurring, we can modify the DOR statements to use FINDOPTIONS. FINDOPTIONS is a record that is used as an optional argument to the Find method. A FINDOPTIONS record consists of an integer value, which specifies how long SilkTest should search for a control and a boolean value that specifies if SilkTest should raise an exception if the control is not found. Therefore if your script used a statement similar to the following:

 [ ] Desktop.Find("//MainWin[@caption='Some Window']").exists(10)

The above statement should now read as:

 [ ] Desktop.Find("//MainWin[@caption='Some Window']", {10,false})


Using the latter statement will enure SilkTest searches for the window "//MainWin[@caption='Some Window']" for 10 seconds and not raise an exception.

The latter statement functions fine if a user simply wants to wait for a window to be found, however what if a user has a window that may or may not appear? The exists method returned a true or false boolean value that could be used within a conditional statement to take different actions depending on whether a window exists or not, the Find method does not provide a boolean value on which to build a conditional statement.
 
It is true that the Find method does not provide a simple boolean value on which to evaluate whether a window exists or not, the Find method simply returns the window. If the Find method does not find the window and we specify via FINDOPTIONS not to raise an exception, the Find method will return "null". Therefore using this behaviour, we can build our conditional statement:


 [ ] //If SilkTest does not find the window after 10 seconds
 [-] if(Desktop.Find("MainWin[@caption='Some Window']", {10,false}) == null)
  [ ] //perform some action
  [ ] LoadMyApplication()
 [ ]
 [ ] Desktop.Find("MainWin[@caption='Some Window']").SetActive()


Looking at the above code we can see that if the Find method returns "null", SilkTest will call the function "LoadMyApplication".