Forum Discussion

h_jansen's avatar
h_jansen
Occasional Contributor
11 years ago

Check whether a SwingObject exists in a screen

I have in my application an object which I can access through the following VBscript command, meaning that the tools clicks on it:



  Call Aliases.ANVA45.scherm_Formuliersoorten.TabSoort.SwingObject("PicobolTabNative", "Anva", 0).SwingObject("TabbedPane.scrollableViewport").SwingObject("BasicTabbedPaneUI$ScrollableTabPanel", "", 0).Click(24, 9)



Now I want to make a VBscript that can check whether the Object exists, and also continue without an error when it does not.



Can someone give me an example.

1 Reply

  • Hi Herman,

     


    You need to use the WaitSwingObject method along with the Exists property. For example:


    Set obj = Aliases.ANVA45.scherm_Formuliersoorten.TabSoort.SwingObject("PicobolTabNative", "Anva", 0).SwingObject("TabbedPane.scrollableViewport")


    If obj.WaitSwingObject("BasicTabbedPaneUI$ScrollableTabPanel", "", 0, 3000).Exists Then


      obj.SwingObject("BasicTabbedPaneUI$ScrollableTabPanel", "", 0).Click()


    Else


      Log.Message("The object doesn't exist")


    End If