Forum Discussion

AKarandjeff's avatar
AKarandjeff
Contributor
14 years ago

WaitAWTObject

Does anyone have any familiarity working with the WaitAWTObject method?  Anyone have an example they can share?  I have a situation where I am trying to add in some wait time on a combo box appearing in a pop up window.  I can't seem to figure out how to properly use this method based on the documentation.  If I try to do a "getName" on my object, it's coming back null.  If I were to use the object browser, what name value should I grab?  Does anyone have an example where WaitAWTObject actually gets used?  There's not one in the help or online. Thanks.  Using JScript

4 Replies

  • Hi,


    To use the WaitAWTObject method correctly, find the AWTObject method that is used to address the needed object in the Object Browser and add the Wait prefix to the method name and one more parameter - Timeout.


    For example, in my application, the AWTObject("test","",0) method is used to address the application form (see the attached image). So, to wait the application form, I'll use the following statement:



    The following example illustrates the use of the WaitAWTObject method in scripts:



    function test2()

    {

      var appForm;



      // Wait for the application form for 10 seconds

      appForm = Sys.Process("java").WaitAWTObject("test", "", 0, 10000);

      if (appForm.Exists)

        Log.Message("Found")

      else

        Log.Message("Not found")

     }

  • Thanks for the response, it gave me the start I needed.  I ended up using the WaitAliasChild method as I'm using name mapping.  That said, I wan't sure to what level I needed to specify and your example really helped up.  Here's what I ended up doing:


    var objWait =


    Aliases.javaw.dialog4.RootPane.null_layeredPane.null_contentPane.OptionPane.OptionPane_buttonArea.WaitAliasChild("OptionPane_button", 10000);


    //Log.Message(obj, objWait, objWait.Exists);



            if (objWait.Exists)


              optionPane.Panel.OptionPane_realBody.OptionPane_body.OptionPane_comboBox.ClickItem(swConnType);


            else


    Log.Error(obj + " not found, ending");



    Also is there an easier way to copy and paste code snippets from TC into the forum so it's not crazy spaced?