Hi all, how do we get to know the co ordinates of a Search text from QTP, which occurs more than once.

or how do we know the No.of occurances of a text on a page???

i was trying with below code.

<font class="small">Code:</font><hr /><pre>
Call GetTextLocation

Sub GetTextLocation()
l = -1
t = -1
r = -1
b= -1
Set GameRef=Window("regexpwndtitle:=Microsoft Internet Explorer","text:="&amp;InputLink&amp;".*").WinObje ct("Object class:=MacromediaFlashPlayerActiveX")
If GameRef.Exist Then
result =GameRef.GetTextLocation("Spin", l, t, r, b)
If result Then
MsgBox "Text found. Coordinates:" &amp; l &amp; "," &amp; t &amp; "," &amp; r &amp; "," &amp; b
x = (l+r) / 2
y = (t+b) / 2
GameRef.Click x,y,0
End If
End If
End Sub
</pre><hr />

when i run this script this will identify the first occurance of "Spin", but how to get the Nth occurance of Random Button.

In my case "Spin" is found two times as
1.Last Spin as Plain text and
2.Spin - A button

i need to click on Spin Button , where as it is clicking on Last Spin Plain Text.