Hello, I need a very simple thing, that I actually find extremely difficult using macro scheduler. I need to search for a word in a window (actually in this case in a web page, and it's a link) and make the macro do 2 different things: if it finds the word in the page, goto a label, if it doesnt find it, goto another label.
I tried using find window with text and if result= NOT FOUND then goto a label else goto another. But it looks like it doesnt see the link in any case as the result is always NOT FOUND.
Please help
Search for text in a window
Moderators: Dorian (MJT support), JRL
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
have you tried just using getwindowtext> to dump the entire contents of your window to a variable? You can then use position> to choose your branch.
ie.
getwindowtext>[windowname],var1
position>[texttofind],%var1%,1,startpos
if>%startpos%>0
do something
else
do something else
endif
I assume this method could be entirely unsuitable however, depending on what site you are dealing with and what you are trying to do, so the above post is probably far better advice :p
ie.
getwindowtext>[windowname],var1
position>[texttofind],%var1%,1,startpos
if>%startpos%>0
do something
else
do something else
endif
I assume this method could be entirely unsuitable however, depending on what site you are dealing with and what you are trying to do, so the above post is probably far better advice :p
--
If its a web page, why not use HTTPRequest>?
For example this will find or not find teh text assigned to variable "TextToFind". And branch to different lables depending on whether the text is found or not found.
[code]
Let>TextToFind=SilverSliver
HTTPRequest>http://www.mjtnet.com/forum/viewtopic.p ... ,,GET,,web
Separate>web,%TextToFind%,var
If>var_count>1,Found,NotFound
Goto>EOF
Label>Found
MDL>Found %TextToFind%
Goto>EOF
Label>NotFound
MDL>Did not find %TextToFind%
Goto>EOF
Label>EOF
[/code]
For example this will find or not find teh text assigned to variable "TextToFind". And branch to different lables depending on whether the text is found or not found.
[code]
Let>TextToFind=SilverSliver
HTTPRequest>http://www.mjtnet.com/forum/viewtopic.p ... ,,GET,,web
Separate>web,%TextToFind%,var
If>var_count>1,Found,NotFound
Goto>EOF
Label>Found
MDL>Found %TextToFind%
Goto>EOF
Label>NotFound
MDL>Did not find %TextToFind%
Goto>EOF
Label>EOF
[/code]