Jump to content
dadalt95

Copy text from HTML, StringBetween EOL

Recommended Posts

dadalt95

Hello everyone!

 

What I have (HTML CODE):

p1.PNG

 

My autoit code:

Quote

$sPhoneNumber = _StringBetween(_IEDocReadHTML($oIE) , '<SPAN style="FONT-WEIGHT: bold">Mensagem:</SPAN></TD></TR>', 'Linha')


MsgBox(0,0, $sPhoneNumber[0])


FileWrite($hFilehandle, $sPhoneNumber[0])

 

What I get (message and file):

p2.PNGp3.PNG

 

What I want:

p4.PNG

 

The main question here is how do I put End Of Line in _StringBetween?

 

Thanks in advance!

 

Share this post


Link to post
Share on other sites
Subz

Have you taken into account @CR and @LF of the form?  You may need to do a StringReplace or StringRegExReplace of the InnerHTML first before using _StringBetween alternatively you could also use something like:

#include <IE.au3>

$oiE = _IECreate("http://somesite.com", 1)
$oTRS = _IETagNameGetCollection($oiE, "tr")
For $oTR in $oTRS
    If $oTR.InnerText = "Mensagem: " Then
        MsgBox(0,'', "InnerHTML = " & $oTR.nextElementSibling.innerHTML)
        MsgBox(0,'', "InnerText = " & $oTR.nextElementSibling.innerText)
    EndIf
Next

 

  • Like 1

Share this post


Link to post
Share on other sites
dadalt95
10 hours ago, Subz said:

Have you taken into account @CR and @LF of the form?  You may need to do a StringReplace or StringRegExReplace of the InnerHTML first before using _StringBetween alternatively you could also use something like:

#include <IE.au3>

$oiE = _IECreate("http://somesite.com", 1)
$oTRS = _IETagNameGetCollection($oiE, "tr")
For $oTR in $oTRS
    If $oTR.InnerText = "Mensagem: " Then
        MsgBox(0,'', "InnerHTML = " & $oTR.nextElementSibling.innerHTML)
        MsgBox(0,'', "InnerText = " & $oTR.nextElementSibling.innerText)
    EndIf
Next

 

Thanks!!! The @CRLF worked great. It was a very newbie question!

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

×