Jump to content
Sign in to follow this  
BlackPhoenix

[Solved] _Stringbetween problem

Recommended Posts

BlackPhoenix

hello I seem having problems with _Stringbetween, it just returns 0 and I need it to return a value that differs each time

$statsource='<H1>Persoonlijke Gegevens</H1>
<P>
<TABLE width=540 align=center>
<TBODY>
<TR>
<TD align=left width=100>Rang</TD>
<TD align=left width=200>Junkie</TD>
<TD align=left width=100>Geslacht</TD>'
$rRang=_StringBetween($statsource,'<TD align=left width=100>Rang</TD><TD align=left width=200>','</TD>')
    consolewrite ($rRang)

It should return:'Junkie'. Can't seem to get it to work. Anyone an idea? If you wondered, i did get $statsource with _Inetgetsource()

And I did #Include <String.au3>

Edited by BlackPhoenix

Share this post


Link to post
Share on other sites
Valuater

#Include <string.au3>
#Include <array.au3>

$statsource='<H1>Persoonlijke Gegevens</H1><P><TABLE width=540 align=center><TBODY><TR><TD align=left width=100>Rang</TD><TD align=left width=200>unkie</TD><TD align=left width=100>Geslacht</TD>'
$rRang=_StringBetween($statsource,"width=200>","</TD>")

_ArrayDisplay($rRang)

MsgBox(4096, "", $rRang[0])

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
BlackPhoenix

#Include <string.au3>
#Include <array.au3>

$statsource='<H1>Persoonlijke Gegevens</H1><P><TABLE width=540 align=center><TBODY><TR><TD align=left width=100>Rang</TD><TD align=left width=200>unkie</TD><TD align=left width=100>Geslacht</TD>'
$rRang=_StringBetween($statsource,"width=200>","</TD>")

_ArrayDisplay($rRang)

MsgBox(4096, "", $rRang[0])

8)

Tnx however it turned out to be a problem on my side about something i overlooked xD

Share this post


Link to post
Share on other sites
Valuater

Tnx however it turned out to be a problem on my side about something i overlooked xD

Yea!! See... you are always right, you were wrong once only because you thought you were wrong and you were actually right... ^_^

Welcome

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
BlackPhoenix

Yea!! See... you are always right, you were wrong once only because you thought you were wrong and you were actually right... ^_^

Welcome

8)

I changed it to this:

func Statscheck()
Servercheck()
$oIE =_IEAttach("Camorra World") 
$oIEe=_IEnavigate( $oIE, $Server&'.camorraworld.nl/user/dashboard.php')
$IEbody=_IEDocReadHTML($oIE)
If @Error then 
    Consolewriteerror('Could not get the source of the stats')
Else
$rStats=_StringBetween($IEbody,"width=200>","</TD>")
$rRang=$rStats[0];Because it returns more than 1 value (4)

Endif
Endfunc

Share this post


Link to post
Share on other sites
Valuater

I changed it to this:

func Statscheck()
Servercheck()
$oIE =_IEAttach("Camorra World") 
$oIEe=_IEnavigate( $oIE, $Server&'.camorraworld.nl/user/dashboard.php')
$IEbody=_IEDocReadHTML($oIE)
If @Error then 
    Consolewriteerror('Could not get the source of the stats')
Else
$rStats=_StringBetween($IEbody,"width=200>","</TD>")
$rRang=$rStats[0];Because it returns more than 1 value (4)

Endif
Endfunc
Just a few more lessons...

1 you should always use "Tidy Autoit Source" ii's in SciTe under "Tools". this will really help clean-up, capitalize and tab the script properly ( and more)

2 In a function, you should use "Return" to release it/memmory/whatever Like... "Return $rRang" as the last line

just some thoughts

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
SmOke_N

Just a few more lessons...

1 you should always use "Tidy Autoit Source" ii's in SciTe under "Tools". this will really help clean-up, capitalize and tab the script properly ( and more)

2 In a function, you should use "Return" to release it/memmory/whatever Like... "Return $rRang" as the last line

just some thoughts

8)

Don't forget (3) - Always verify your array (with @error where applicable or IsArray() ) ^_^ Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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  

×