tags:

views:

31

answers:

2

I have been using the following code to check whether a dialog is already open

If  Window(window_name).Dialog(dialog_name).Exist = False 
    Then '' //here qtp waits..
    Window(window_name).WinMenu("Menu").Select menu_name
End If

This code is to avoid reopening the same dialog during each run of the code. But the qtp run waits about 10 - 15 seconds & then goes to next step. in what way we can avoid this?

If the dialog is not open, then the menu will be clicked to open the dialog.

+1  A: 

The Exist property accepts a value of how long to wait for the object to exist.

If Window(window_name).Dialog(dialog_name).Exist(60) = False

BTW, Exist returns a Boolean not a string so you should compare to False not "False".

Motti
BTW, you can use the logical `Not` operator instead of comparing to `False`: `If Not Window(window_name).Dialog(dialog_name).Exist(60) Then ...`.
Helen
A: 

The method mentioned is good. You can also try this method,

If (Window(window_name).Dialog(dialog_name).winbutton(Btn_name).Getroproperty("abs_x"))

This returns true if the object exists if not it returns false.

sreeram