Sorak99 Posted June 28, 2006 Share Posted June 28, 2006 Hello,I am trying to make a program that goes to http://www.saintsreport.com/ then only clicks on the full story links from today.I found a script a while back that helps decipher certain fields:expandcollapse popup; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.1.0 ; Author: A.N.Other <myemail@nowhere.com> ; ; Script Function: ; Template AutoIt script. ; ; ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <IE.au3> ; Set a COM Error handler -- only one can be active at a time (see helpfile) $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") ; Create a browser window, navigate and click to the AutoIt Forum Search page $oIE = _IECreate () _IENavigate ($oIE, "http://www.saintsreport.com/") ;_IEClickLinkByText ($oIE, "forum") ;_IEClickLinkByText ($oIE, "Search") ; Show information for each HTML elemetn on a page $o_all = _IETagNameAllGetCollection ($oIE) $sHTM = _IECollectionTable($o_all, "Characteristics of all HTML Elements on page") $oIE1 = _IECreate () _IEBodyWriteHTML ($oIE1, $sHTM) ; Show information for each A (anchor) tag $o_all = _IETagNameGetCollection ($oIE, "a") $sHTM = _IECollectionTable($o_all, "Characteristics of all 'a' Links") $oIE2 = _IECreate () _IEBodyWriteHTML ($oIE2, $sHTM) ; Show attributes for each IMG tag $o_all = _IETagNameGetCollection ($oIE, "img") $sHTM = _IECollectionTable($o_all, "Characteristics of all 'img' Links") $oIE3 = _IECreate () _IEBodyWriteHTML ($oIE3, $sHTM) ; Show information on each form and its elements $o_all = _IEFormGetCollection ($oIE) $oIE4 = _IECreate () $icnt = 0 For $form in $o_all $sBody = _IEBodyReadHTML($oIE4) If $icnt = 0 Then $sBody = "" $sHTM = _IECollectionTable($form, "Elements for form " & $icnt) _IEBodyWriteHTML ($oIE4, $sBody & $sHTM) $icnt = $icnt + 1 Next Exit Func _IECollectionTable($o_collection, $s_title = "HTML Element Collection") Dim $adata[5] Dim $i = 0 Dim $sHTML = "" $sHTML = $sHTML & "<h2>" & $s_title & "</h2>" & @CR $sHTML = $sHTML & "<table border=1 cellpadding=3>" & @CR $sHTML = $sHTML & "<tr bgcolor=navy><td><font color=""white""><b>Object Type</b></font>" $sHTML = $sHTML & "<td><font color=""white""><b>Object Count</b></font>" $sHTML = $sHTML & "<tr><td>" & ObjName ($o_collection) & "</td><td>" & $o_collection.length & "</td></tr></table>" & @CR & @CR ; $sHTML = $sHTML & "<h3>Element Characteristics</h3>" & @CR $sHTML = $sHTML & "<table border=1 cellpadding=3>" & @CR $sHTML = $sHTML & "<tr bgcolor=navy><td><font color=""white""><b>Index</b></font>" $sHTML = $sHTML & "</td><td><font color=""white""><b>Tag</b></font>" $sHTML = $sHTML & "</td><td><font color=""white""><b>Name</b></font>" $sHTML = $sHTML & "</td><td><font color=""white""><b>Id</b></font>" $sHTML = $sHTML & "</td><td><font color=""white""><b>Extra Information</b></font>" $sHTML = $sHTML & "</td><td><font color=""white""><b>Object Type</b></font>" $sHTML = $sHTML & "</td></tr>" & @CR For $a In $o_collection ; SetError(0) $tmp = $a.tagname If @error = 1 Then $tmp = " " If $tmp = "0" Then $tmp = " " $adata[0] = $tmp ; SetError(0) $tmp = $a.name If @error = 1 Then $tmp = " " If $tmp = "0" Then $tmp = " " $adata[1] = $tmp ; SetError(0) $tmp = $a.id If @error = 1 Then $tmp = " " If $tmp = "0" Then $tmp = " " $adata[2] = $tmp ; Select Case $a.tagname = "a" SetError(0) $tmp = "Link Text: " & $a.innerText & "<br>href: " & $a.href If @error = 1 Then $tmp = " " If $tmp = "0" Then $tmp = " " $adata[3] = $tmp Case $a.tagname = "img" SetError(0) $tmp = "Img SRC: " & $a.src & "<br>alt Text: " & $a.alt If @error = 1 Then $tmp = " " If $tmp = "0" Then $tmp = " " $adata[3] = $tmp Case $a.tagname = "input" SetError(0) $tmp = "Form Input Type: " & $a.type & "<br>Value: " & $a.value If @error = 1 Then $tmp = " " If $tmp = "0" Then $tmp = " " $adata[3] = $tmp Case $a.tagname = "option" SetError(0) $tmp = "Option index: " & $a.index & "<br>Value: " & $a.value & "<br>Selected: " & $a.selected If @error = 1 Then $tmp = " " If $tmp = "0" Then $tmp = " " $adata[3] = $tmp Case Else $adata[3] = " " EndSelect ; SetError(0) $tmp = ObjName ($a) If @error = 1 Then $tmp = " " If $tmp = "0" Then $tmp = " " $adata[4] = $tmp ; $sHTML = $sHTML & "<tr><td class=tr-main>" & $i $sHTML = $sHTML & "</td><td class=tr-main>" & $adata[0] $sHTML = $sHTML & "</td><td class=tr-main>" & $adata[1] $sHTML = $sHTML & "</td><td class=tr-main>" & $adata[2] $sHTML = $sHTML & "</td><td class=tr-main>" & $adata[3] $sHTML = $sHTML & "</td><td class=tr-main>" & $adata[4] $sHTML = $sHTML & "</td></tr>" & @CR $i = $i + 1 Next $sHTML = $sHTML & "</table>" & @CR Return $sHTML EndFunc ;==>_IECollectionTable Func MyErrFunc() ; Set @ERROR to 1 and return control to the program following the trapped error SetError(1) EndFunc ;==>MyErrFuncbut my progress is slow in most cases and in this instance I'm stuck on how to proceed. George Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted June 28, 2006 Moderators Share Posted June 28, 2006 This should either get you started, or confuse you really bad. #include <IE.au3> _IEErrorHandlerRegister () ; Create a browser window and navigate to a webpage $oIE = _IECreate ("http://www.saintsreport.com", 1) ; Get a collection object of all Links $oLinks = _IELinkGetCollection ($oIE) ; Loop through all Links For $oLink In $oLinks $sLinkText = $oLink.outerText & "" If StringInStr($sLinkText, "Full Story -") Then $oParent = $oLink.parentElement For $i = 1 To 6 $oParent = $oParent.parentElement Next $oParent = $oParent.previousSibling $sParentText = $oParent.innerText If StringInStr($sParentText, "Today @") Then $sLinkPath = $oLink.href _IECreate ($sLinkPath, 0, 1, 0) EndIf EndIf Next Link to comment Share on other sites More sharing options...
Valuater Posted June 28, 2006 Share Posted June 28, 2006 very nice big_daddy! I just thought he took some script, posted it and was asking alot so i didn't even try 8) Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted June 28, 2006 Moderators Share Posted June 28, 2006 very nice big_daddy!I just thought he took some script, posted it and was asking alotso i didn't even try8)Thanks!It was a little harder than I initially thought, but I finally figured it out. Link to comment Share on other sites More sharing options...
Sorak99 Posted June 28, 2006 Author Share Posted June 28, 2006 This should either get you started, or confuse you really bad.It does both, but i will study it for a few days. very nice big_daddy!I just thought he took some script, posted it and was asking alotso i didn't even try8)The script i put up is a tool i use to make anything with IE.au3, found it in a much earlier post. Other than opening up the site, i had no idea how to start. So i wanted to give anyone that wanted to help me something rather than nothing. I figure most people find it unncessary and i believe that this code doesnt need it at all. (i suck bad with IE.au3 and ExcelCom.au3)I feel bad sometimes asking because its just like when your playing a mmorpg and the low levels bug you for free stuff. (yes im an autoit noob i admit it!)In any case Thank you very much big_daddy! Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted June 28, 2006 Moderators Share Posted June 28, 2006 Glad I was able to help.You may want to take a look at the IE Builder that Valuater made. Link to comment Share on other sites More sharing options...
Sorak99 Posted June 28, 2006 Author Share Posted June 28, 2006 Glad I was able to help.You may want to take a look at the IE Builder that Valuater made.Much appreciated. Link to comment Share on other sites More sharing options...
Sorak99 Posted June 29, 2006 Author Share Posted June 29, 2006 Quick question..... How did you know about .outerText and .href ? I dont see them anywhere on the Autoit help files Is there a list of these that i can study? George Link to comment Share on other sites More sharing options...
Valuater Posted June 29, 2006 Share Posted June 29, 2006 (edited) in the IE. au3 Builder mentioned by big_daddythere are addresses built into the drop-down combo list that take you to MSDN references..i found this one therehttp://msdn.microsoft.com/workshop/author/...bj_document.asp8) Edited June 29, 2006 by Valuater Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted June 29, 2006 Moderators Share Posted June 29, 2006 I always keep this link handy.DHTML Properties Link to comment Share on other sites More sharing options...
Valuater Posted June 29, 2006 Share Posted June 29, 2006 I always keep this link handy.DHTML Propertiesthat should be put into the list also 8) Link to comment Share on other sites More sharing options...
Sorak99 Posted June 29, 2006 Author Share Posted June 29, 2006 I always keep this link handy.DHTML PropertiesThank you.George 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