Home > Running a Script > Handling Errors & Logging > Handling Object not found Error > Window Not Found

Window Not Found

The UseWindow function provides synchronization within the script, temporarily blocking script execution until the window with the name as specified in UseWindow argument exists and is ready for input. 

If the window with a name as specified in UseWindow cannot be found within the default timeout period of 30 seconds, the function will fail.

If the window name is the correct one as shown on the desktop at replay, but the window does not show within the default timeout period, the amount of time can be increased via the #ActionTimeout system variable. The #ActionTimeout variable can be increased just before the UseWindow function and then restored to it's original value immediately following it.

The window name parameter for the UseWindow function is defined as :
<Executable module>|<Window class>|<Title>[|<Order number],[Instance number]
It is a delimited string. The fields within the string are separated by the "|" (pipe) character.
You can use the SPY tool to manually determine the caption of a window or Recording mode will record it automatically.

The default behavior of the UseWindow function is to allow the script to continue execution as soon as a window with the exact window name as specified in UseWindow exists on desktop and is ready for input. If after #ActionTimeout/10 seconds (as #ActionTimeout default value is 30, the value is 3 secs unless you change #ActionTimeout value), no window with the specified name is found, a "fuzzy match" search starts. WinTask searches a window whose name has the same executable module and the same first characters for the window class as the one specified in the script.

You can change this default behavior by setting the #UseExact system variable to 1 before the UseWindow function. The UseWindow function will now wait for the window to be there with the fully specified window name, and fails no window with the exact window name is found.

The complement to the exact matching behavior invoked by setting the #UseExact system variable to 1 is to use "wildcards" in the UseWindow function. Wildcard behavior is invoked by truncating characters from the end of the window name. Truncation is allowed until the first character of the window class.
To allow the recogniton of any Word window whatever document is loaded, truncate
UseWindow("WINWORD.EXE|OpusApp|Microsoft Word - Referenc.doc",1)
to:
UseWindow("WINWORD.EXE|OpusApp|Microsoft Word",1)


Use the following step-by-step instructions to help diagnose and correct the Window not found error message.


See also
Page Not Found
HTML Element Not Found