Jump to content

Search for string


 Share

Recommended Posts

Is it possible to look for a specific string on a webpage and then do something if a specific one is found?

And if there is... is there a way to just look for any change in string at all? Such as if a webpage displays

"Hello there."

Is there a way to check is that changes, and then put the change into a variable? So that if the page then changes and says

"Hello there. Flawblure"

Then you could put the change, or "Flawblure" into a variable?

I've been looking at IE.au3 and haven't come across a search function for this... not sure if theres just something I'm missing.

Link to comment
Share on other sites

Is it possible to look for a specific string on a webpage and then do something if a specific one is found?

With IE.au3, there are plenty of examples of grabbing the contents of a given webpage, the methods .InnerText and .InnerHTML leap to mind.

Should COM and the beta be too scary or intimidating, use Send() to activate the "View Source" option in your browser of choice. Then you will (likely) have all of the text you can see on the screen. If you're using frames, well....learn COM and the DOM.

Grabbing exactly what you want is an exercise in logic - being able to zero in on what you want in a reproducible fashion. (Things like, the text I want is always the first line, or is always preceded by this color tag, etc. can be useful....This is often called "parsing the source". When you have the string you want, it is trivial to say

if $string == "foo" then 
 ;do stuff  
else
 ; do something else
endif

This method can be extended to arbitrary complexity levels.

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...