d0n Posted August 31, 2006 Share Posted August 31, 2006 (edited) What i want to do is get a bunch of numbers from a website, to do some calculations withheres the source for the websiteand the part i want to get is this <td><img src="img/un/r/1.gif" width="18" height="12" border="0"></td><td>Lumber:</td><td align="right"><b>400 </b></td><td> per hour</td></tr><tr><td><img src="img/un/r/2.gif" width="18" height="12" border="0"></td><td>Clay:</td><td align="right"><b>370 </b></td><td> per hour</td></tr><tr><td><img src="img/un/r/3.gif" width="18" height="12" border="0"></td><td>Iron:</td><td align="right"><b>310 </b></td><td> per hour</td></tr><tr><td><img src="img/un/r/4.gif" width="18" height="12" border="0"></td><td>Crop:</td><td align="right"><b>205 </b></td><td> per hour</td>bolded = the numbers i need, and they will change through timedorf1.php Edited August 31, 2006 by d0n Link to comment Share on other sites More sharing options...
Valuater Posted August 31, 2006 Share Posted August 31, 2006 see this posthttp://www.autoitscript.com/forum/index.ph...=stringbetween#8) Link to comment Share on other sites More sharing options...
DaleHohm Posted August 31, 2006 Share Posted August 31, 2006 Since your data is in a table, check out _IETableWriteToArray (search the helpfile and then look at the examples). Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
dcop Posted September 1, 2006 Share Posted September 1, 2006 What i want to do is get a bunch of numbers from a website, to do some calculations withheres the source for the websiteand the part i want to get is this <td><img src="img/un/r/1.gif" width="18" height="12" border="0"></td><td>Lumber:</td><td align="right"><b>400 </b></td><td> per hour</td></tr><tr><td><img src="img/un/r/2.gif" width="18" height="12" border="0"></td><td>Clay:</td><td align="right"><b>370 </b></td><td> per hour</td></tr><tr><td><img src="img/un/r/3.gif" width="18" height="12" border="0"></td><td>Iron:</td><td align="right"><b>310 </b></td><td> per hour</td></tr><tr><td><img src="img/un/r/4.gif" width="18" height="12" border="0"></td><td>Crop:</td><td align="right"><b>205 </b></td><td> per hour</td>bolded = the numbers i need, and they will change through timeRead the help on all the string functions. The first AI project I did was similar to this and was very easy to learn. Your digits would be very easy to extract and equate. Link to comment Share on other sites More sharing options...
DaleHohm Posted September 1, 2006 Share Posted September 1, 2006 Read the help on all the string functions. ...Or replicate the example for _IETableWriteToArray -- job done in 4 lines of code Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
slipperylobster Posted September 1, 2006 Share Posted September 1, 2006 align="right"><b> Its easier than you think. Each number you are looking for is preceded by the above. I do it the hard way but it works....here is an example of how I search for a quote in a website. script follows........ $filedir = "C:\AA TASKBAR SHORTCUTS\Desk\Hold Basket\Word.txt" $pos1= 0 $pos2= 0 $word = "" $line = "" ;Local $o_speech = ObjCreate ("SAPI.SpVoice") *disabled ;$o_speech.Speak("Here is your quote for today") *disabled $rssfeed = "http://wordsmith.org/words/today.html" InetGet($rssfeed, $filedir) $file = FileOpen($filedir, 0) while 1 $line = FileReadLine($file) $pos1=stringinstr($line,"<quote>") if $pos1>0 then start() wend func start() while 1 $line = FileReadLine($file) $line=stringreplace($line,"<p>","") $word = $word & $line $pos2 = StringInStr($line, "</quote>") If $pos2 > 0 Then end() WEnd endfunc Link to comment Share on other sites More sharing options...
slipperylobster Posted September 1, 2006 Share Posted September 1, 2006 Sorry...I didn't post the entire script...here it is again. $filedir = "C:\AA TASKBAR SHORTCUTS\Desk\Hold Basket\Word.txt" $pos1= 0 $pos2= 0 $word = "" $line = "" $rssfeed = "http://wordsmith.org/words/today.html" InetGet($rssfeed, $filedir) $file = FileOpen($filedir, 0) while 1 $line = FileReadLine($file) $pos1=stringinstr($line,"<quote>") if $pos1>0 then start() wend func start() while 1 $line = FileReadLine($file) $line=stringreplace($line,"<p>","") $word = $word & $line $pos2 = StringInStr($line, "</quote>") If $pos2 > 0 Then end() WEnd endfunc Func end() splashtextOn("Quote For The Day",$word) FileClose($file) Exit EndFunc Link to comment Share on other sites More sharing options...
d0n Posted September 1, 2006 Author Share Posted September 1, 2006 I am having a little trouble with this line $oTable = _IETableGetCollection ($oIE, -1) i don't know what should be the $i_index for my table, how do i find that out? Link to comment Share on other sites More sharing options...
DaleHohm Posted September 1, 2006 Share Posted September 1, 2006 I am having a little trouble with this line$oTable = _IETableGetCollection ($oIE, -1)i don't know what should be the $i_index for my table, how do i find that out?They are numbered sequentially starting with 0. You can look at the source and count <TABLE> tags to get to the one you want (0, 1, 2, 3 etc) then replace the -1 with that number.Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
d0n Posted September 1, 2006 Author Share Posted September 1, 2006 its the 5th one i checked but when i run this code the msgbox shows nothing #include <IE.au3> $oIE = _IECreate ("http://s7.travian.com/dorf1.php") $oTable = _IETableGetCollection ($oIE, 5) $aTableData = _IETableWriteToArray ($oTable) MsgBox(0, "Frame Info", $aTableData) Link to comment Share on other sites More sharing options...
DaleHohm Posted September 1, 2006 Share Posted September 1, 2006 (edited) its the 5th one i checked but when i run this code the msgbox shows nothing #include <IE.au3> $oIE = _IECreate ("http://s7.travian.com/dorf1.php") $oTable = _IETableGetCollection ($oIE, 5) $aTableData = _IETableWriteToArray ($oTable) MsgBox(0, "Frame Info", $aTableData)$aTableData is a 2-D array - the data needs to be accessed by index, $aTableData[$i][$j] (e.g. $aTableData[0][3]). This recent post shows an example of just what you are trying to do and then looping through the array and writing the values to a comma-separated file. Dale Edit: Also note, if it is the 5th <TABLE> tag, you want to use 4 and not 5 since the numbering starts with 0 Edited September 1, 2006 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
d0n Posted September 1, 2006 Author Share Posted September 1, 2006 sorry index 5 not 5th one #include <IE.au3> $oIE = _IECreate ("http://s7.travian.com/dorf1.php") $oTable = _IETableGetCollection ($oIE, 5) $aTableData = _IETableWriteToArray ($oTable) MsgBox(0, "Frame Info", $aTableData[0][1]) still doesn't show me anything in the box tho Link to comment Share on other sites More sharing options...
DaleHohm Posted September 1, 2006 Share Posted September 1, 2006 0, 1 could be an empty cell. Try the example in the other post I pointed you to. Try it with the example from the helpfile as well so that you can see how it is supposed to work. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
d0n Posted September 1, 2006 Author Share Posted September 1, 2006 when i run it with index 5 i get this0,0,0,0Lumber:,Clay:,Iron:,Crop:nonebut it doesn't work when i run on index 6 #include <IE.au3> $oIE = _IECreate ("http://s7.travian.com/dorf1.php") $oTable = _IETableGetCollection ($oIE, 6) $aTableData = _IETableWriteToArray ($oTable) Local $i = 0, $j = 0, $line Local $iMax = Ubound($aTableData, 0) - 1, $jMax = Ubound($aTableData, 1) - 1 For $i = 0 To $iMax $line = "" For $j = 0 to $jMax $line &= $aTableData[$i][$j] If $j = $jMax Then FileWriteLine("book1.txt", $line) Else $line &= "," EndIf Next Next Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted September 1, 2006 Moderators Share Posted September 1, 2006 The table you are wanting is the 5th table, not the 5th index. Link to comment Share on other sites More sharing options...
d0n Posted September 1, 2006 Author Share Posted September 1, 2006 should i write it with the 5th table? and how do i do that? Link to comment Share on other sites More sharing options...
DaleHohm Posted September 1, 2006 Share Posted September 1, 2006 huh? Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
d0n Posted September 1, 2006 Author Share Posted September 1, 2006 how do i select the 5th table? Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted September 1, 2006 Moderators Share Posted September 1, 2006 how do i select the 5th table?With an index number of 4. Link to comment Share on other sites More sharing options...
d0n Posted September 1, 2006 Author Share Posted September 1, 2006 i still get this if i change it to index 4 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