Forum Discussion

vladm's avatar
vladm
Occasional Contributor
14 years ago

WaitObject - is it possible to wait object by name parts of which are dynamic?

Hi,


I need to wait object by name parts of which are dynamic. Can i use "Wait" methods to implement such action? 


Can i write something like: 


ParentObj.WaitChild(Label("First part of child name" + Sys_Date + "Second part of child name"), 1000);   ???



Thanks.

3 Replies

  • karkadil's avatar
    karkadil
    Valued Contributor
    Of course you can. ChildName parameter is a string and you can compose any dynamic string and pass it to the WaitChild method.

    Take a note that ChildName should be exactly as it is displayed in the Object Browser (Name property), for instance



    Sys.Process('calc').WaitChild('Window("CalcFrame", "Calculator", 1)', 1000)



    You can also use wildcards in ChildName to replace dynamic parts of the string, for instance

    ParentObj.WaitChild("First part of child name*Second part of child name", 1000);



    BTW, you can read this article (in Russian) which describes how to work with Wait and Find methods
  • Hi,



    Gennadiy's second example should probably read:

    ParentObj.WaitChild('Label("First part of child name*Second part of child name")', 1000);


    For Label objects, you can also use WaitLabel instead of WaitChild:

    ParentObj.WaitLabel("First part of child name*Second part of child name", 1000);