Rashard76 Posted November 20, 2010 Share Posted November 20, 2010 hello guys i am quite new to Autoit so i will probably ask something stupid buy evidently i was not good enough to read the help files and the forum that's what i want to do. I log in on a site, i navigate to a webpage, i replace some value inside the html code, then i get the third table from the page and i put it in an array. My problem is in the third step: if i replace the value with the "StringReplace" then i cant make work the _IETableGetCollection. If i don't do the "stringreplace" everything works (but it is not useful to me...) this is the code (my last horrid try, lol). What i am trying to replace is obviously inside the third table that i'd like to get: expandcollapse popup#include <INet.au3> ; needed for get source (hmtl) #include <String.au3> ; needed for stringbetween #include <IE.au3> #include <GuiConstantsEx.au3> #include <UpDownConstants.au3> #include <ComboConstants.au3> #Include <Array.au3> $oIE =_IECreate('http://www.site.com/index.php', 0, 1) $o_login = _IEGetObjByName($oIE,"username") _IEFormElementSetValue ($o_login, "myusername") $o_password = _IEGetObjByName($oIE,"password") _IEFormElementSetValue ($o_password, "mypassword") $o_signin=_IEGetObjByName($oIE,"submit") _IEAction($o_signin,"click") _IELoadWait ($oIE) _IENavigate ($oIE, "http://www.site.com/page100.php") $sText = _IEBodyReadText ($oIE) $m0 = StringReplace($sText, "A", 0) $m1 = StringReplace($m0, "ONE", 1) $m2 = StringReplace($m1, "TWO", 2) $m3 = StringReplace($m2, "THREE", 3) $m4 = StringReplace($m3, "FOUR", 4) $m5 = StringReplace($m4, "FIVE", 5) $m6 = StringReplace($m5, "SIX", 6) $m7 = StringReplace($m6, "SEVEN", 7) $m8 = StringReplace($m7, "EIGHT", 8) $m9 = StringReplace($m8, "NINE", 9) $m10 = StringReplace($m9, "TEN", 10) $m11 = StringReplace($m10, "ELEVEN", 11) $m12 = StringReplace($m11, "TWELVE", 12) $m13 = StringReplace($m12, "THIRTEEN", 13) $m14 = StringReplace($m13, "FOURTEEN", 14) $m15 = StringReplace($m14, "FIFTEEN", 15) $m16 = _IEBodyReadText ($m15) $oTable = _IETableGetCollection ($m16, 3) $aTableData = _IETableWriteToArray ($oTable, True) $sCSV = "" For $r = 0 to UBound($aTableData,1) - 1 $sCSV = $sCSV & @LF For $c = 0 to UBound($aTableData,2) - 1 $sCSV = $sCSV & $aTableData[$r][$c] & " " MsgBox(4096,"Array Contents", $aTableData[$r][$c] & " - " & $r) Next ; MsgBox(4096,"Array Contents", $sCSV) Next MsgBox(4096,"Array Contents", $sCSV) I get the "IE.au3 V2.4-0 Error from function _IETableGetCollection, $_IEStatus_InvalidDataType" error. I am pretty sure that i am doing a mess... anyone can give me a hint? Link to comment Share on other sites More sharing options...
Zedna Posted November 20, 2010 Share Posted November 20, 2010 ... $sText = _IEBodyReadText ($oIE) ; here it's OK you read from web page into string variable $m0 = StringReplace($sText, "A", 0) $m1 = StringReplace($m0, "ONE", 1) $m2 = StringReplace($m1, "TWO", 2) $m3 = StringReplace($m2, "THREE", 3) $m4 = StringReplace($m3, "FOUR", 4) $m5 = StringReplace($m4, "FIVE", 5) $m6 = StringReplace($m5, "SIX", 6) $m7 = StringReplace($m6, "SEVEN", 7) $m8 = StringReplace($m7, "EIGHT", 8) $m9 = StringReplace($m8, "NINE", 9) $m10 = StringReplace($m9, "TEN", 10) $m11 = StringReplace($m10, "ELEVEN", 11) $m12 = StringReplace($m11, "TWELVE", 12) $m13 = StringReplace($m12, "THIRTEEN", 13) $m14 = StringReplace($m13, "FOURTEEN", 14) $m15 = StringReplace($m14, "FIFTEEN", 15) ; here it's BAD you try to read from string variable by using function which expects web page ($oIE) $m16 = _IEBodyReadText ($m15) ; here it's BAD you try to read from string variable by using function which expects web page ($oIE) $oTable = _IETableGetCollection ($m16, 3) $aTableData = _IETableWriteToArray ($oTable, True) ... Look at these functions: _IEBodyWriteHTML(), _IEPropertySet() -> "innertext" Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
Rashard76 Posted November 20, 2010 Author Share Posted November 20, 2010 thx for the hints, i will try to adjust my code starting from what u told me Link to comment Share on other sites More sharing options...
Rashard76 Posted November 21, 2010 Author Share Posted November 21, 2010 Sigh... i am not finding the way Basically i want to transform the values in other values (in this case "SIX" will become "6" and so on). That's a piece of the table, which contains 2 thousand records similar to these ones <td align="center" width="111">SIX</td> <td align="center" width="109">THREE</td> I need to do the transformation before getting the table with the _IETableGetCollection. I was looking _IEPropertySet and _IEBodyWriteHTML() and from what i understood, they need "ID" or "NAME" and i am not understanding how i can use them in my situation since i have not Is there not something like "Stringreplace" that i can use? Anyone can help? Link to comment Share on other sites More sharing options...
Tvern Posted November 21, 2010 Share Posted November 21, 2010 _IEBodyWriteHTML does not need an id, or name. You can do something like: _IEBodyReadHTML -> StringReplace -> _IEBodyWriteHTML But why do you need to do the conversion before you get the table? It'd be much easier to do it afterwards. Anyways if you could post the source as provided by _IEBodyReadHTML, or the url to the page (if it doesn't require login) it'll be easier to help you. Link to comment Share on other sites More sharing options...
Rashard76 Posted November 21, 2010 Author Share Posted November 21, 2010 _IEBodyWriteHTML does not need an id, or name. You can do something like:_IEBodyReadHTML -> StringReplace -> _IEBodyWriteHTMLBut why do you need to do the conversion before you get the table? It'd be much easier to do it afterwards.Anyways if you could post the source as provided by _IEBodyReadHTML, or the url to the page (if it doesn't require login) it'll be easier to help you.Thx to your post I understood what i was doing wrong: i was using the IEBodyReadText instead of IEBodyReadHTML. Now i did some positive steps and looks like i am getting the table as i wanted ) I will continue tomorrow (i will have to query inside the converted table) By the way, sorry for my bad english 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