ThyElite Forums  
Go Back   ThyElite Forums > MyCoke Talk > Help!
Reload this Page Visual Basic Help?
Reply
 
Thread Tools Display Modes
(#1)
Old
Sifter is Offline
Master of the Post
Sifter is on a distinguished road
 
Posts: 309
Join Date: Jul 2006
Location: Stockton, California
Send a message via AIM to Sifter Send a message via MSN to Sifter Send a message via Yahoo to Sifter
Default Visual Basic Help? - 07-28-2006, 11:42 PM

I'm currently working on a newer, better version of SumoPrizeGrabber. I need to know how to make a status checker in Inet for one of the prizes.
Heres the URL for inet to connect to:
Code:
http://mycoke.com/sumo.do?screenname=" + Text1.Text + "&prize=1
The text1 is a textbox with your vegos name, for example, if your username was USER;
Code:
http://mycoke.com/sumo.do?screenname=USER&prize=1
If successful, it will return with something saying
Code:
<result code="0" />
If it says anything else, it's unsuccessful. How do i make a status checker that checks what is returned and says either Failed, or Success On a label named Label3?
Reply With Quote
(#2)
Old
Heff is Offline
Super Moderator
Heff is on a distinguished road
 
Posts: 482
Join Date: Jun 2006
Location: USA
Send a message via AIM to Heff
Default 07-29-2006, 12:06 AM

Add this function:
Code:
Public Function GetStringBetween(ByVal InputText As String, _
                                 ByVal StartText As String, _
                                 ByVal EndText As String, _
                                 Optional ByVal StartPosition = 1) As String

    'Standard Function as supplied by Mumei - NOT case sensitive and uses mid, not mid$
    Dim lnTextStart As Long
    Dim lnTextEnd As Long

    lnTextStart = InStr(StartPosition, InputText, StartText, vbTextCompare) + Len(StartText)
    lnTextEnd = InStr(lnTextStart, InputText, EndText, vbTextCompare)
    If lnTextStart >= (StartPosition + Len(StartText)) And lnTextEnd > lnTextStart Then
        'we've found the entry
        GetStringBetween = Mid(InputText, lnTextStart, lnTextEnd - lnTextStart)
    Else
        GetStringBetween = ""
    End If
End Function


Here's how to make success/failed

Code:
Buffer = WebBrowser3.Navigate ("http://www.mycoke.com/sumo.do?screenname=" + Text1.Text + "&prize=3")

If code="0" = GetStringBetween(Buffer, "<result", "/>") Then
        lblStatus = "Success"
Else
       lblStatus = "Failed"
End If

UNTESTED


DaTrueHeff
Reply With Quote
(#3)
Old
Sifter is Offline
Master of the Post
Sifter is on a distinguished road
 
Posts: 309
Join Date: Jul 2006
Location: Stockton, California
Send a message via AIM to Sifter Send a message via MSN to Sifter Send a message via Yahoo to Sifter
Default 07-29-2006, 12:11 AM

Thanks, but uh... where do I put the second one in?
EDIT: Nevermind, i got it, by deleting the Buffer = part. But it comes up with Failed no matter what, and how do i make it work for all 3? Individually i mean.
EDIT2: It pretty much works, just now it instantly makes it say Failed.

Last edited by Sifter : 07-29-2006 at 12:31 AM. Reason: So i wouldnt double post.
Reply With Quote
(#4)
Old
Heff is Offline
Super Moderator
Heff is on a distinguished road
 
Posts: 482
Join Date: Jun 2006
Location: USA
Send a message via AIM to Heff
Default 07-29-2006, 12:47 AM

Let me see your source.


DaTrueHeff
Reply With Quote
(#5)
Old
Sifter is Offline
Master of the Post
Sifter is on a distinguished road
 
Posts: 309
Join Date: Jul 2006
Location: Stockton, California
Send a message via AIM to Sifter Send a message via MSN to Sifter Send a message via Yahoo to Sifter
Default 07-29-2006, 01:55 AM

Code:
Public Function GetStringBetween(ByVal InputText As String, _
                                 ByVal StartText As String, _
                                 ByVal EndText As String, _
                                 Optional ByVal StartPosition = 1) As String

    'Standard Function as supplied by Mumei - NOT case sensitive and uses mid, not mid$
    Dim lnTextStart As Long
    Dim lnTextEnd As Long

    lnTextStart = InStr(StartPosition, InputText, StartText, vbTextCompare) + Len(StartText)
    lnTextEnd = InStr(lnTextStart, InputText, EndText, vbTextCompare)
    If lnTextStart >= (StartPosition + Len(StartText)) And lnTextEnd > lnTextStart Then
        'we've found the entry
        GetStringBetween = Mid(InputText, lnTextStart, lnTextEnd - lnTextStart)
    Else
        GetStringBetween = ""
    End If
End Function

Private Sub Command1_Click()
WebBrowser1.Navigate ("http://mycoke.com/sumo.do?screenname=" + Text1.Text + "&prize=1")
If code = "0" = GetStringBetween(Buffer, "<result code=", "/>") Then
        Label3.Caption = "Success!"
Else
       Label3.Caption = "Failed."
End If

WebBrowser2.Navigate ("http://mycoke.com/sumo.do?screenname=" + Text1.Text + "&prize=2")
If code = "0" = GetStringBetween(Buffer, "<result", "/>") Then
        Label4.Caption = "Success!"
Else
       Label4.Caption = "Failed."
End If

WebBrowser3.Navigate ("http://www.mycoke.com/sumo.do?screenname=" + Text1.Text + "&prize=3")
If code = "0" = GetStringBetween(Buffer, "<result code=", "/>") Then
        Label5.Caption = "Success!"
Else
       Label5.Caption = "Failed."
End If
End Sub
Reply With Quote
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Visual Basic 6 TAG General Talk 0 10-10-2006 10:24 PM
Need Visual Basic 6 TAG General Talk 0 10-10-2006 09:29 PM
Visual Basic 6 Masked Requests 3 08-22-2006 07:44 PM
A basic MyCoke login in Visual Basic 6 DefectiveProduct Cheat Talk 6 07-18-2006 06:40 AM
Visual Basic 6 Matt_Hardy Shithole 3 06-22-2006 12:01 PM



Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.