BlackPhoenix Posted April 28, 2009 Share Posted April 28, 2009 (edited) 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 April 28, 2009 by BlackPhoenix Link to comment Share on other sites More sharing options...
Valuater Posted April 28, 2009 Share Posted April 28, 2009 #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) Link to comment Share on other sites More sharing options...
BlackPhoenix Posted April 28, 2009 Author Share Posted April 28, 2009 #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 Link to comment Share on other sites More sharing options...
Valuater Posted April 28, 2009 Share Posted April 28, 2009 Tnx however it turned out to be a problem on my side about something i overlooked xDYea!! See... you are always right, you were wrong once only because you thought you were wrong and you were actually right... Welcome8) Link to comment Share on other sites More sharing options...
BlackPhoenix Posted April 28, 2009 Author Share Posted April 28, 2009 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 Link to comment Share on other sites More sharing options...
Valuater Posted April 28, 2009 Share Posted April 28, 2009 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) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 28, 2009 Moderators Share Posted April 28, 2009 (edited) 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 linejust some thoughts8)Don't forget (3) - Always verify your array (with @error where applicable or IsArray() ) Edited April 28, 2009 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. Link to comment Share on other sites More sharing options...
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