elmoi0010 Posted January 19, 2014 Posted January 19, 2014 (edited) Hello guys i want to know how to grab text from a website table ? like this: i want to get that "Phone Number". i was triying with >this but it dont work or i cant make it work :S. anyone can help me ? Edited January 19, 2014 by elmoi0010
michaelslamet Posted January 19, 2014 Posted January 19, 2014 Maybe something like this: $sPhoneNumber = _StringBetween(_IEDocReadHTML($oIE) , 'Phone Number:</b>"', '"') MsgBox(0,0, $sPhoneNumber[0]) Note that _StringBetween is included in string.au3
elmoi0010 Posted January 19, 2014 Author Posted January 19, 2014 Maybe something like this: $sPhoneNumber = _StringBetween(_IEDocReadHTML($oIE) , 'Phone Number:</b>"', '"') MsgBox(0,0, $sPhoneNumber[0]) Note that _StringBetween is included in string.au3 Is not working bro :C.
michaelslamet Posted January 19, 2014 Posted January 19, 2014 Is not working bro :C. "not working" is not helping much What is not working and what did you get? You want to grab the number number (eg: 206-338-0815), is that correct? If yes, that above code should serve you well
elmoi0010 Posted January 19, 2014 Author Posted January 19, 2014 "not working" is not helping much What is not working and what did you get? You want to grab the number number (eg: 206-338-0815), is that correct? If yes, that above code should serve you well i did this bro :C. #include <ie.au3> #include <string.au3> $oIE = _IECreate ("http://msrunes.esy.es/") _IELoadWait($oIE) $sPhoneNumber = _StringBetween(_IEDocReadHTML($oIE) , 'Phone Number:</b>"', '"') MsgBox(0,0, $sPhoneNumber[0]) I Dont know bro am very new to autoit :s
michaelslamet Posted January 19, 2014 Posted January 19, 2014 This should work: #include <ie.au3> #include <string.au3> $oIE = _IECreate ("http://msrunes.esy.es/") _IELoadWait($oIE) $sPhoneNumber = _StringBetween(_IEDocReadHTML($oIE) , 'Phone Number:</b> ', '</TD>') If Not @error then MsgBox(4096,"Info", $sPhoneNumber[0]) Else MsgBox(4096,"Error", "Can not find phone number") EndIf Anyway, the help file and searching through this forum is a great place to learn
Solution elmoi0010 Posted January 19, 2014 Author Solution Posted January 19, 2014 This should work: #include <ie.au3> #include <string.au3> $oIE = _IECreate ("http://msrunes.esy.es/") _IELoadWait($oIE) $sPhoneNumber = _StringBetween(_IEDocReadHTML($oIE) , 'Phone Number:</b> ', '</TD>') If Not @error then MsgBox(4096,"Info", $sPhoneNumber[0]) Else MsgBox(4096,"Error", "Can not find phone number") EndIf Anyway, the help file and searching through this forum is a great place to learn Thanks you so much bro it works <3
PhoenixXL Posted January 19, 2014 Posted January 19, 2014 (edited) Another Example #include <IE.au3> Local $oIE = _IECreate() _IEDocWriteHTML($oIE, HTML()) Local $oTableDatas = _IETagNameGetCollection ($oIE, "td") For $oTableData In $oTableDatas If StringRegExp($oTableData.innerText, "Phone Number") Then ConsoleWrite("Phone Number : " & StringRegExpReplace($oTableData.innerText, "(?s).*?(\d)([\d\-]+).*", "\1\2") & @CRLF) ExitLoop EndIf Next Func HTML() $sHTML = _ "<html><body>" & _ "<table><tbody><tr><td><b>" & _ "Phone Number: </b> '206-338-2015'</td></tr></tbody>" & _ "</table></body></html>" Return $sHTML EndFunc With Website #include <ie.au3> $oIE = _IECreate ("http://msrunes.esy.es/") Local $oTableDatas = _IETagNameGetCollection ($oIE, "td") For $oTableData In $oTableDatas If StringRegExp($oTableData.innerText, "Phone Number") Then ConsoleWrite("Phone Number : " & StringRegExpReplace($oTableData.innerText, "(?s).*?(\d)([\d\-]+).*", "\1\2") & @CRLF) ExitLoop EndIf Next Edited January 19, 2014 by PhoenixXL jaberwacky 1 My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
Gianni Posted January 19, 2014 Posted January 19, 2014 this remembers me a similar post where was freely searched a word after another word in the whole page (not just within a table)>here is the link of my solution, in that script just change the http address in the second line and put "Phone Number" in the $substring variable. with a little adaptation it can be also useful to your purpose bye Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
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