Jump to content

Recommended Posts

Posted

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.

Posted

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.

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
  • Recently Browsing   0 members

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