darkei Posted July 6, 2008 Share Posted July 6, 2008 Hey, I'm new(ish) to AutoIt, and I was wondering, is it possible to make a program that will check a website for a certain text string and return true or false if it's there or not? Without opening a new browser window.. I know it can be done in other languages, but I have no idea about AutoIt, which is why I'm asking before trying and becoming disappointed ;p Thanks for any answer you can give me muttley ~Darkei Link to comment Share on other sites More sharing options...
TomZ Posted July 6, 2008 Share Posted July 6, 2008 Look into INetGet (cleaner) or _INetGetSource (easier) and StringInStr. Link to comment Share on other sites More sharing options...
darkei Posted July 6, 2008 Author Share Posted July 6, 2008 Look into INetGet (cleaner) or _INetGetSource (easier) and StringInStr.Thanks muttleyI'll take a look, but I can't seem to find _INetGetSource anywhere :\ Link to comment Share on other sites More sharing options...
nobbe Posted July 6, 2008 Share Posted July 6, 2008 (edited) you could use embeded IE , too _IENavigate($oIE, $url) $my_text = _IEBodyReadHTML($oIE) If StringInStr($my_text, "BLABLA") > 0 Then Edited July 6, 2008 by nobbe Link to comment Share on other sites More sharing options...
darkei Posted July 6, 2008 Author Share Posted July 6, 2008 you could use embeded IE , too _IENavigate($oIE, $url) $my_text = _IEBodyReadHTML($oIE) If StringInStr($my_text, "BLABLA") > 0 Then Okay thanks, I'll explain further what I'm wanting to do if it helps. I want to have a GUI with a text box, and a "Submit" button that, when pressed, will check a certain webpage for the text string entered in that textbox. I then want it to show a popup box for true/false. What would you say is best to do that with? (If it's still possible?) Link to comment Share on other sites More sharing options...
nobbe Posted July 6, 2008 Share Posted July 6, 2008 try this change to where you want to browse $url="http://www.google.com"; expandcollapse popup#include <GUIConstants.au3> #include <IE.au3> Global $oIE = _IECreateEmbedded () #Region ### START Koda GUI section ### Form= $Browser = GUICreate("Browser", 650, 450, 185, 145) $GUIActiveX1 = GUICtrlCreateObj($oIE, 25, 50, 600, 160); or use 0,0,0,0 to make "invisible" $First_Link_Input = GUICtrlCreateInput("", 48, 24, 225, 21) $Surf1_Button = GUICtrlCreateButton("find", 538, 24, 80, 21, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $url="http://www.google.com"; ; Waiting for user to close the window While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Surf1_Button _IENavigate ($oIE, $url); navigate $my_text = _IEBodyReadHTML($oIE) $search = GUICtrlRead ($First_Link_Input) If StringInStr($my_text, $search) > 0 Then msgBox(0,"FOUND","FOUND " & $search); else msgBox(0,"no match","not FOUND " & $search); endif EndSelect WEnd GUIDelete() exit Link to comment Share on other sites More sharing options...
darkei Posted July 6, 2008 Author Share Posted July 6, 2008 (edited) try this change to where you want to browse $url="http://www.google.com"; expandcollapse popup#include <GUIConstants.au3> #include <IE.au3> Global $oIE = _IECreateEmbedded () #Region ### START Koda GUI section ### Form= $Browser = GUICreate("Browser", 650, 450, 185, 145) $GUIActiveX1 = GUICtrlCreateObj($oIE, 25, 50, 600, 160); or use 0,0,0,0 to make "invisible" $First_Link_Input = GUICtrlCreateInput("", 48, 24, 225, 21) $Surf1_Button = GUICtrlCreateButton("find", 538, 24, 80, 21, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $url="http://www.google.com"; ; Waiting for user to close the window While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Surf1_Button _IENavigate ($oIE, $url); navigate $my_text = _IEBodyReadHTML($oIE) $search = GUICtrlRead ($First_Link_Input) If StringInStr($my_text, $search) > 0 Then msgBox(0,"FOUND","FOUND " & $search); else msgBox(0,"no match","not FOUND " & $search); endif EndSelect WEnd GUIDelete() exit I <3 you. (in a non-gay-thanks-for-helping type way muttley) Will post if any further problems Edited July 6, 2008 by darkei Link to comment Share on other sites More sharing options...
darkei Posted July 6, 2008 Author Share Posted July 6, 2008 Okay, just one small problem now.I need it to link to a particular webpage (example: http://www.google.com/x/y/z/webpage.html) yet it only seems to want to link to the root page.Is there anything I can do here? Link to comment Share on other sites More sharing options...
nobbe Posted July 6, 2008 Share Posted July 6, 2008 do you need a login or is it a valid link? i mean can you open it just without login in regular internet explorer or firefox`? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now