Overlord Posted July 10, 2007 Share Posted July 10, 2007 Hi guys, how can I read the first (topmost) result from the second column from a webpage? Bitcomet has the cometzone where u can see yuor upload-points and I just wanna know when I have reached my limit for that day without having to check each time. Leftside columnname is Date righside columnname is Day Score I need to find the number in the field below. How can this be done? Thanx in advance! Overlord Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 10, 2007 Share Posted July 10, 2007 (edited) Hi guys, how can I read the first (topmost) result from the second column from a webpage? Bitcomet has the cometzone where u can see yuor upload-points and I just wanna know when I have reached my limit for that day without having to check each time. Leftside columnname is Date righside columnname is Day Score I need to find the number in the field below. How can this be done? Thanx in advance! OverlordUse IE.au3 UDF Connect to IE on the page Get the object for the form/frame (if used) Get the table data to an array with _IETableWriteToArray() Your data should be in $avArray[2][0], which looks a little backwards if you are used to [row][col] convention. Edit: _IETableWriteToArray... Doh! Edited July 10, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Overlord Posted July 10, 2007 Author Share Posted July 10, 2007 Use IE.au3 UDF Connect to IE on the page Get the object for the form/frame (if used) Get the table data to an array with _IETableReadToArray() Your data should be in $avArray[2][0], which looks a little backwards if you are used to [row][col] convention. mmh... $oIE = _IE_Example ("table") $oTable = _IETableGetCollection ($oIE, 1) $aTableData = _IETableWriteToArray ($oTable) this gives me a blank page and not the page I need... I need a hand here guys, I really lost all the little skill that I had :-( _ietablereadtoarray I can't find in the help The page I want to view is "http://passport.bitcomet.com/client/mydetails/?l=en_us&v=0.90" u would have 2 columns there. If I can get a msgbox with the first line of the second column that would help me out. please? Link to comment Share on other sites More sharing options...
Qualitybit Posted July 10, 2007 Share Posted July 10, 2007 mmh... $oIE = _IE_Example ("table")$oTable = _IETableGetCollection ($oIE, 1)$aTableData = _IETableWriteToArray ($oTable) this gives me a blank page and not the page I need...I need a hand here guys, I really lost all the little skill that I had :-(_ietablereadtoarray I can't find in the helpThe page I want to view is "http://passport.bitcomet.com/client/mydetails/?l=en_us&v=0.90"u would have 2 columns there. If I can get a msgbox with the first line of the second column that would help me out.please?Extracting tables issn't that hard nut but there are many ways how to get depending on different circumstances like frames etc. resulting in "blank pages".So without a closer look into the source of the page you want to examine, our answer could not have more details then your question...101011 [font="Courier New"][center]Me vs. 127.0.0.1 =>> 0:2But I never give up! >:-][/center][/font] Link to comment Share on other sites More sharing options...
mikehunt114 Posted July 10, 2007 Share Posted July 10, 2007 I'm pretty sure PsaltyDS was talking about _IETableWriteToArray(). #include <IE.au3> #include <Array.au3> $oIE = _IE_Example ("table") $oTable = _IETableGetCollection ($oIE, 1) $aTableData = _IETableWriteToArray ($oTable) _ArrayDisplay($aTableData) $oIE.quitHopefully you can get it from there. IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
Overlord Posted July 10, 2007 Author Share Posted July 10, 2007 (edited) I got it to work with this code. #include <IE.au3> $oIE = _IECreate ("http://passport.bitcomet.com/client/mydetails/?l=en_us&v=0.90", 0,0 ) $sHTML = _IEBodyReadText ($oIE) $result = StringTrimLeft ($sHTML, 721) + stringtrimright ( $sHTML, 1) MsgBox(0, "Found it", $result ) it looks like it's doing what I want it to do. Not quite happy with the $result string. Need to look into that further. But it works :-) the reason I need the stringtrimleft and right is becasue I just need a few particular numbers in that table. Will see tomorrow if result is what it's need to be. thx for help so far guys! Edited July 10, 2007 by Overlord Link to comment Share on other sites More sharing options...
mikehunt114 Posted July 10, 2007 Share Posted July 10, 2007 _IETableWriteToArray sounds like a much better solution. Access the single cell where the desired info is....instead of trimming an entire HTML document. IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 10, 2007 Share Posted July 10, 2007 I'm pretty sure PsaltyDS was talking about _IETableWriteToArray().To quote to sage philosopher, Simpson: Doh! :"> Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Overlord Posted July 11, 2007 Author Share Posted July 11, 2007 (edited) _IETableWriteToArray sounds like a much better solution. Access the single cell where the desired info is....instead of trimming an entire HTML document.gonna look into it now :-)expect some more questions since I know zero, null, nothing, nada about arrays :-(EDIT: mmh, now I get a columnview from what I need indeed. Now I need to filter out the first column, first row thing. Maybe stringsplit could do it Edited July 11, 2007 by Overlord Link to comment Share on other sites More sharing options...
mikehunt114 Posted July 11, 2007 Share Posted July 11, 2007 #include <IE.au3> #include <Array.au3> $oIE = _IE_Example ("table") $oTable = _IETableGetCollection ($oIE, 0) $aTableData = _IETableWriteToArray ($oTable) $bound = Ubound($aTableData) ;store the maximum number of rows in a single column as the var $bound Dim $aSecondColumn[$bound] ;create a new array of the same length as the first For $i = 0 to ($bound - 1) ;0-based index for arrays means you need to subtract 1 from the max $aSecondColumn[$i] = $aTableData[1][$i] ;assign value of column two, row $i to the new array Next _ArrayDisplay($aSecondColumn) $oIE.quitoÝ÷ Øò¢ê')ÞyÚ'yé^éíÊ%j×¢µ©Ýjëh×6$desiredValue = $aTableData[$row][$column] IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
Overlord Posted July 11, 2007 Author Share Posted July 11, 2007 (edited) "Heroes are ordinary men who do extraordinary things.".... I COULD KISS YOU!! lol $desiredValue = $aTableData[$row][$column] that was exactly what I needed. why don't I find this anywhere in the helpfile. No wonder I need so much help. Now I need to open a running program and edit preferences in that program. One luck, the thing I have to edit is always on the same position :-) Edited July 11, 2007 by Overlord Link to comment Share on other sites More sharing options...
mikehunt114 Posted July 11, 2007 Share Posted July 11, 2007 Arrays can be very good friends IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
Overlord Posted July 11, 2007 Author Share Posted July 11, 2007 (edited) here's my entire code. can someone check for some errors? What it does is verify my score on a webpage and if score is not 120 then it will stay uploading at 40 but when 120 is reached it switches to 3. uses a sleep of 30 minutes to check each time again. expandcollapse popup#include <IE.au3> #include <Array.au3> Opt("WinWaitDelay", 100) Opt("WinTitleMatchMode", 1) Opt("WinDetectHiddenText", 1) Opt("MouseCoordMode", 0) Do $oIE = _IECreate("http://passport.bitcomet.com/client/mydetails/?l=en_us&v=0.90", 0, 0) $oTable = _IETableGetCollection($oIE, 4) $aTableData = _IETableWriteToArray($oTable) $dayscore = $aTableData[1][1] ;MsgBox(0, "Current Dayscore ", $dayscore ) $oIE.quit If $dayscore = 120 Then zeroupload() If $dayscore < 120 Then maxupload() Sleep(1800000); 30 minutes sleep Until $dayscore = 120 Func maxupload() Run("C:\Program Files\BitComet\BitComet.exe", "", @SW_MAXIMIZE) If Not WinActive("BitComet") Then WinActivate("BitComet") WinWaitActive("BitComet") MouseClick("left", 610, 65, 1) WinWait("Preferences...") If Not WinActive("Preferences...") Then WinActivate("Preferences...") WinWaitActive("Preferences...") MouseClick("left", 500, 130, 2) Send("40{ENTER}") WinWait("BitComet 0.90") If Not WinActive("BitComet") Then WinActivate("BitComet") WinWaitActive("BitComet 0.90") MouseClick("left", 1011, 19, 1) EndFunc ;==>maxupload Func zeroupload() Run("C:\Program Files\BitComet\BitComet.exe", "", @SW_MAXIMIZE) If Not WinActive("BitComet") Then WinActivate("BitComet") WinWaitActive("BitComet") MouseClick("left", 610, 65, 1) WinWait("Preferences...") If Not WinActive("Preferences...") Then WinActivate("Preferences...") WinWaitActive("Preferences...") MouseClick("left", 500, 130, 2) Send("3{ENTER}") WinWait("BitComet 0.90") If Not WinActive("BitComet") Then WinActivate("BitComet") WinWaitActive("BitComet 0.90") MouseClick("left", 1011, 19, 1) EndFunc ;==>zeroupload Edited July 11, 2007 by Overlord 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