Forum Discussion

Clever's avatar
Clever
New Contributor
14 years ago

Index of Window is sometimes changing.

Hello.



I have a problem with the index of the Window Object. Sometimes it is changing from Index 2, to Index 3.



For example:




var  p1;

var  w1;

p1 = Sys.Process("ntvdm");

w1 = p1.Window("ThunderForm", "Retoure", 3); <- Index 3 does sometimes work and sometimes Index needs to be 2...



Is the reason for the Problem the program which i am testing or am i doing something wrong?

I hope you can help me, Thanks!



Greets Clever


2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Basically, what the index means is that there are more windows than just one that have the same class and caption.  So, each time you run your tests, it's opening another instance of the same form.



    Now, if this is expected, then you might need to use something like a FindChild or some such thing to search for the form using some other parameters other than just name and caption.  The index essentially references, IIRC, the order in which the form was created so using some other parameters you can narrow down to your specific requested form.