Sign in to follow this  
Followers 0
elmoi0010

get text from table ?

9 posts in this topic

#1 ·  Posted (edited)

Hello guys i want to know how to grab text from a website table ? like this:

screenshot_32.png

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 by elmoi0010

Share this post


Link to post
Share on other sites



Maybe something like this:

$sPhoneNumber = _StringBetween(_IEDocReadHTML($oIE) , 'Phone Number:</b>"', '"')
MsgBox(0,0, $sPhoneNumber[0])

 

Note that _StringBetween is included in string.au3

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Is not working bro :C.

 

"not working" is not helping much :P

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

Share this post


Link to post
Share on other sites

"not working" is not helping much :P

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

Share this post


Link to post
Share on other sites

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 :)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#8 ·  Posted (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 by PhoenixXL
1 person likes this

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.

Share this post


Link to post
Share on other sites

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


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0