Sign in to follow this  
Followers 0
CyberGlitch

Search Webpage

3 posts in this topic

Looking for a way to search the current website for certain text and depending on if true/false then go from there. I can make a vbs script to convert a static page to a txt file with html code and search that. What I would like though is to have the script go to a page, wait for it to load, then search that page. The page will say something like yes it's currently avaiable or no new updates and I want it to do different things depending on the current text on the page.

I thought about making it ^F text and then either wait for a no text found box or not but there has got to be an easier way to do it.

Share this post


Link to post
Share on other sites



there are many ways to do it, but many times I just prefer to download the page, load it into a variable and check that way.:

$x=URLDownloadToFile ("http://www.hiddensoft.com/index.php","testthisout.html")
If $x=0 Then exit(1)
Run(@comspec&" /c testthisout.html","",@SW_HIDE) 
MsgBox(1,"done?","")
FileDelete("testthisout.html")

You can read the file and determine if your text is in there.

ex:

$x=URLDownloadToFile ("http://www.hiddensoft.com/index.php","testthisout.html")
If $x=0 Then exit(1)
;Run(@comspec&" /c testthisout.html","",@SW_HIDE) 

$file = FileOpen("testthisout.html", 0)
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf
    $chars = FileRead($file, 999999)
    If @error = -1 Then ExitLoop
FileClose($file)
If StringInStr($chars,"AutoIt is a freeware")>0 Then 
    RunWait(@comspec&" /c testthisout.html","",@SW_HIDE) 
Else
    MsgBox(1,"Not there","")
EndIf

;AutoIt is a freeware
MsgBox(1,"done?","")
FileDelete("testthisout.html")

I also use send("^a^c") and then $x=clipget() or use the send("^f") and use the find function. Just might want to make sure the whole page is loaded first.

My example is just a quick one, but might give a few options.


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Thanks for the other suggestions. Havn't read to much of the docs for v3 so didn't know about the URLDownloadToFile feature. Will have to look into that.

Share this post


Link to post
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
Sign in to follow this  
Followers 0