Showing results for 
Search instead for 
Did you mean: 

Significance of the number "1" in code Aliases.dlgAttributeFilter.Window("Button", "OK",1).

Occasional Contributor

Significance of the number "1" in code Aliases.dlgAttributeFilter.Window("Button", "OK",1).



In the following code, can someone please tell me the significance of each parameters?


Aliases.dlgAttributeFilter.Window("Button", "OK",1).

As far as my observation, I deduced the line of code as "Window that contains Button named as OK which is postioned as 1"


Is it correct?

I even found that, if we dont use the number "1" even then the code runs fine , then what is the importance of adding the using an extra parameter? Because, in one window(active) there will be one OK button. So, even without the number the code would work then, Can you please tell me why do we need the extra parametre of number i.e. "1"?




Community Hero

Re: Significance of the number "1" in code Aliases.dlgAttributeFilter.Window("Button&

The "Window" object type in TestComplete is described in


Basically, the three fields are, in order from left to right, the WndClass, the WndCaption, and the Index... the number "1" is not position, but an "index" of objects... if there are, for some reason, two objects with the same WndClass and WndCaption, then there would be one with a number 1 and one with a number 2.


The reason why it works fine without the 1 in your example is because there is no other object with that class and caption... so, the index is superfluous.  

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
New Here?
Join us and watch the welcome video:
Top Kudoed Authors