Results 1 to 10 of 10

Thread: Why is my variable not printing to my list?

  1. #1

    Joined
    Feb 2012
    Posts
    223
    Userbars
    4
    Thanks
    72
    Thanked
    44/13
    DL/UL
    60/2
    Mentioned
    29 times
    Time Online
    1d 21h 39m
    Avg. Time Online
    N/A

    Why is my variable not printing to my list?

    I use the same format for other tasks just like this in my script, but for some reason, this one is not adding my strEmail to my list, any suggestions? Thank you in advance!

    My Code:
    Code:
    Dim strEmail As String
    strHTML = wrapper.Request("GET", "http://www.neopets.com/email_change.phtml", "http://www.neopets.com/userinfo.phtml")
    strEmail = GetStringBetween(strHTML, "size=""""30"""" maxlength=""""60"""">", "</td>")
    List1.AddItem ("Email: " + strEmail)


    Page Source
    Code:
    <td><input type="hidden" name="old_email" value="[email protected]" size="30" maxlength="60">[email protected]</td>

  2. #2

    Joined
    Dec 2011
    Posts
    262
    Thanks
    22
    Thanked
    106/68
    DL/UL
    22/0
    Mentioned
    74 times
    Time Online
    N/A
    Avg. Time Online
    N/A
    List1.additem "Email: " & strEmail

  3. #3

    Joined
    Feb 2012
    Posts
    223
    Userbars
    4
    Thanks
    72
    Thanked
    44/13
    DL/UL
    60/2
    Mentioned
    29 times
    Time Online
    1d 21h 39m
    Avg. Time Online
    N/A
    Thanks, but it still does not show the email :/

  4. #4

    Joined
    Dec 2011
    Posts
    262
    Thanks
    22
    Thanked
    106/68
    DL/UL
    22/0
    Mentioned
    74 times
    Time Online
    N/A
    Avg. Time Online
    N/A
    Ok then something is wrong with your GSB.

    Use.

    strEmail = GetStringBetween(strHTML, "60" & Chr(34) & ">", "")

  5. #5
    Zachafer's Avatar
    Joined
    Dec 2011
    Posts
    1,235
    Userbars
    11
    Thanks
    769
    Thanked
    1,466/678
    DL/UL
    98/0
    Mentioned
    512 times
    Time Online
    24d 13h 9m
    Avg. Time Online
    8m
    Code:
    Debug.Print "size=""""30"""" maxlength=""""60"""">"
    Output: size=""30"" maxlength=""60"">

    Try this:

    Code:
    Dim strEmail As String
    strHTML = wrapper.Request("GET", "http://www.neopets.com/email_change.phtml", "http://www.neopets.com/userinfo.phtml")
    strEmail = GetStringBetween(strHTML, "size=""30"" maxlength=""60"">", "</td>")
    List1.AddItem ("Email: " & strEmail)
    It is ok to use "+" for (you need an account to see links) but in visual basic we use "&" (or some of us use Mid$ )

    The & operator is recommended for string concatenation because it is defined exclusively for strings and reduces your chances of generating an unintended conversion.

  6. #6

    Joined
    Dec 2011
    Posts
    77
    Userbars
    3
    Thanks
    3
    Thanked
    32/22
    DL/UL
    30/0
    Mentioned
    24 times
    Time Online
    18d 20h 37m
    Avg. Time Online
    6m
    Quote Originally Posted by Zachafer View Post
    (or some of us use Mid$ )
    Why/how would you use Mid$ for concatenation?

  7. #7

    Joined
    Dec 2011
    Posts
    151
    Userbars
    2
    Thanks
    4
    Thanked
    165/45
    DL/UL
    14/9
    Mentioned
    68 times
    Time Online
    6d 17h 26m
    Avg. Time Online
    2m
    Take out the quotes
    Code:
    strHTML = Replace(strHTML, """", "")
    Source will be
    Code:
    <td><input type=hidden name=old_email [email protected] size=30 maxlength=60>[email protected]</td>
    Then use
    Code:
    strEmail = GetStringBetween(strHTML, "maxlength=60>", "</td>")
    List1.additem "Email: " & strEmail

  8. #8
    Zachafer's Avatar
    Joined
    Dec 2011
    Posts
    1,235
    Userbars
    11
    Thanks
    769
    Thanked
    1,466/678
    DL/UL
    98/0
    Mentioned
    512 times
    Time Online
    24d 13h 9m
    Avg. Time Online
    8m
    Quote Originally Posted by Hexx View Post
    Why/how would you use Mid$ for concatenation?
    Why: Faster, especially when there are a lot of concatenations.

    How: (you need an account to see links)
    (you need an account to see links)

  9. #9
    Reemer's Avatar
    Joined
    Dec 2011
    Posts
    639
    Userbars
    8
    Thanks
    364
    Thanked
    446/256
    DL/UL
    39/0
    Mentioned
    203 times
    Time Online
    4d 13h 47m
    Avg. Time Online
    1m
    Quote Originally Posted by Soredavide View Post
    Take out the quotes
    Code:
    strHTML = Replace(strHTML, """", "")
    Source will be
    Code:
    <td><input type=hidden name=old_email [email protected] size=30 maxlength=60>[email protected]</td>
    Then use
    Code:
    strEmail = GetStringBetween(strHTML, "maxlength=60>", "</td>")
    List1.additem "Email: " & strEmail
    Damn why did I never think of just removing the quotes -_-
    Thanks man, you probably just saved me lots of time

  10. #10

    Joined
    Dec 2011
    Posts
    77
    Userbars
    3
    Thanks
    3
    Thanked
    32/22
    DL/UL
    30/0
    Mentioned
    24 times
    Time Online
    18d 20h 37m
    Avg. Time Online
    6m
    Quote Originally Posted by Zachafer View Post
    Why: Faster, especially when there are a lot of concatenations.

    How: (you need an account to see links)
    (you need an account to see links)
    how often do you have to actually concatenate strings of 50kb or more though? i can't think of one situation where I've ever had to do that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •