Things you'll need:
6 labels
1 timer
1 textbox
3 inet controls
If you don't know how to draw an inet on your form, hit CTRL+T to bring up the project components. Scroll down and tick the box next to Microsoft Internet Transfer Control and hit Apply. A little icon of a computer and the earth behind it will appear in your toolbar. Click that icon and just draw the inets anywhere on your form.
LEAVE ALL OBJECT NAMES AS DEFAULT. DO NOT CHANGE THEIR NAMES.
Now.
Change the textboxes text to a quotation mark. Just one quotation mark, that's all.
And set the textboxes Visible property to FALSE.
Now set your timers interval to 3000 and set it's Enabled property to TRUE.
Arrange your labels in this order
Quote:
Label1 Label2
Label3 Label4
Label5 Label6
|
Now change Label1s caption to "Open/Closed:"
Change Label3s caption to "Online:"
And change label5s caption to "Capacity"
For a better look, I would set the font for labels 2, 4 and six to bold. You don't have to, I just think it looks good. For a placeholder, I also made the captions for labels 2, 4 and 6 "Null"
Now your form should look something like this.
Now insert this code into your timer, and you're finished.
Code:
On Error Resume Next 'Just in case.
Dim strCode As String
Dim strCode2 As String
Dim strCode3 As String
' Get the closed/open status
strCode = Inet1.OpenURL("http://cokestudios2.cokemusic.com/sf/status?timestamp=")
strCode = Split(Split(strCode, "SS=" & Text1.Text & "")(1), "" & Text1.Text & " T")(0)
SPLITRESULT = strCode
If InStr(SPLITRESULT, "<") Or strCode = "" Then 'Checks to see if the split performed properly. The < is something you see in alot of failed splits because the failed split gets the entire page of the source. And sometimes failed splits do not get anything at all. Yeah, you get it.
Label2.Caption = "ERROR"
Else ' If the split does not contain the < character and is NOT absolutely nothing, this if function is done to determine whether the studios are open or not
If InStr(strCode, "O") Then
Label2.Caption = "Open"
Else
Label2.Caption = "Closed"
End If
End If
' Get the Online status
strCode2 = Inet2.OpenURL("http://cokestudios2.cokemusic.com/sf/status?timestamp=")
strCode2 = Split(Split(strCode2, "TSO=" & Text1.Text & "")(1), "" & Text1.Text & "")(0)
SPLITRESULT2 = strCode2
If InStr(SPLITRESULT2, "<") Or SPLITRESULT2 = "" Then
Label4.Caption = "ERROR"
Else
Label4.Caption = SPLITRESULT2
End If
'Get the capacity status
strCode3 = Inet3.OpenURL("http://cokestudios2.cokemusic.com/sf/status?timestamp=")
strCode3 = Split(Split(strCode3, "TSMC=" & Text1.Text & "")(1), "" & Text1.Text & " SS=")(0)
SPLITRESULT3 = strCode3
If InStr(SPLITRESULT3, "<") Or strCode = "" Then
Label6.Caption = "ERROR"
Else
Label6.Caption = SPLITRESULT3
End If
That's all there is to it.
I would apreciate any comments or suggestions.
Attatched below is a source and example application.
Hope this helps.