Jump to content

get text from table ?


Go to solution Solved by elmoi0010,

Recommended Posts

"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

Link to comment
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 :)

Link to comment
Share on other sites

  • Solution

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

Link to comment
Share on other sites

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

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.

Link to comment
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

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...