Forum Discussion

melanieKno's avatar
Occasional Contributor
6 months ago

WaitForm() method?

I need to wait for a Form object below a java process. The caption of the form is dynamic that's why I cannot use NameMapping. 

In Python the code at the bottom returns "found" when the object is open, but how can I implement the same using a wait method? WaitForm() is not available. Sometimes it takes several minutes for the form until it's shown. 

def test():
process = Sys.Process("java")
caption = "ECH *"

formObject = process.Form(f"{caption}")
if formOjbect.Exists:
Log.Message("doesn't exist")

3 Replies

  • Marsha_R's avatar
    Champion Level 3

    Here are all your options for Wait


    You can still use Name Mapping on a dynamic caption. Take a look at these options:

  • rraghvani's avatar
    Champion Level 3

    A Python example,

    p = Sys.Process("Notepad")
    # Waits for the window for 10 seconds
    w = p.WaitWindow("*", "Open*", -1, 10000)
    if w.Exists:
      Log.Picture(w, "Open dialog picture")
      Log.Warning("Incorrect window")

    ...which is similar to what you have.