Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attachmate Extra Word Search (Multiple occurance)

Status
Not open for further replies.

bitli

Technical User
Feb 19, 2004
7
TR
Hi All,

I need to search a word, I saw the examples and previous questions on this toppic, but what I need extra is I have multiple occurance of the same word in the page, so once I do a search and get the coordinates, I will have to go about searching the screen again and find the next occurance and so on...

Can anyone help..

Thanks a lot
 
What have you got so far?

[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
Hello Mr. Nelson,

I just got the search and get coordinate part, it works fine, but it only finds the first occurance, I want it to continue...

Set SC = Sess0.Screen.Search("C-")

xTop = SC.Top
xBottom = SC.Bottom


MyScreen.MoveTo xTop ,5 'Always the same coord for right (x)
Set MyArea = MyScreen.Area(1, 1, 1, 1,,3)

MyArea.Top = xTop
MyArea.Left = 51
MyArea.Right = 54
MyArea.Bottom = xBottom

numofawb = CINT(trim(MyArea.Value))
 
The Search function has 2 optional components. After you give it the search string you can give it a starting Row and Col. So to find the next occurrence you would add:

Set SC = Sess0.Screen.Search("C-", MyArea,Top, MyArea.Left+1)

This would start the search at the character to the left of the previously found string.

You can use a loop if you need to find several instances.

calculus
 
Thanks a lot calculus, this was great.

One more question I have, could you tell me how to exit a nested for loop? But not sub, cause I have a while outside of all..

while
for1

for2
if a condition meets I want to exit to label but GoTo label does not work here
next2
next1
label:
wend
 
I used an boolean variable and set to true if the xondition met, and used exit for again if the flag set to true..
while
for1

for2
if a condition meets exit for set the flag
next2
if flagset then exit for again
exit1
label:
wend

guess this will work... Thanks for looking anyway.. if you have a better solution would be great. Ofcouse label useless here
 
When I use nested loops I will use a label to exit. So...


do
do
do
If X meets my criteria then goto ExitMyLoop:
loop
loop
loop

ExitMyLoop:


calculus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top