Forum Discussion

Oferv's avatar
Oferv
Super Contributor
13 years ago

How to recognize if window exist by the text it display

Hi,



i have this line as a condition and it doesn't work for me.



if(Aliases["FusionDesktop"]["dlgWarning"]["WaitWindow"]("Static", "Loading a new......", 3000)["Exists"])



this condition is true but somehow the script skip it 



why is that?and how can i make sure the script find out if a window display properly by the text it display?



NOTE:I can't use the window's header since i have few windows one after the other with the same header,which is "Warning"



Thanks


1 Reply

  • Hi,


    If you have several windows with the same caption, you can use other properties to recognize the needed window, for example, the Index property. To know the window index, explore the target window with the Object Spy and view the value of the Index property of the corresponding window object. After that, you can use the Find method to search for the needed window in the test:




    function Test()

    {

      var PropArray, ValuesArray, p, w;

     

      // Creates arrays of property names and values

      PropArray = new Array("WndCaption", "Index");

      ValuesArray = new Array("MyWindow", 2);



      // Searches for the window

      p = Sys.Process("MyProcess");

      w = p.Find(PropArray, ValuesArray, 5);



      // Processes the search results

      if (w.Exists)

        Log.Message(w.FullName);

      else

        Log.Error("The object was not found.");

    }


    If you still need to find the needed window by its text, you can use the Optical Character Recognition technology. For more information, please refer to http://smartbear.com/support/viewarticle/11241/.