Sythe.Org Forums     Register     FAQ     Members List     Calendar     Mark Forums Read    
 
Sythe.Org Forums  
   Runescape Gold

Sythe.org — A Virtual Goods Trading Hub

Make real cash! buying and selling in-game items.

We have a no-scam policy.

You can make thousands playing your favourite games here at Sythe.org.

Just sign up an account and follow the rules!


Take me to

Runescape Markets

Other Game Markets

Support Center

Register an Account

Close
[HELP] Parseing in vb6
Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 03-26-2011, 07:54 PM
Active Member
 
Join Date: May 2006
Posts: 122
Send a message via AIM to dgameman1 Send a message via MSN to dgameman1 Send a message via Skype™ to dgameman1
Default [HELP] Parseing in vb6

I am trying to learn how to parse information.
For my first time, I want a messagebox to be able to say
"Example of a simple HTML page"
(http://help.nucleus.com/example_of_a..._html_page.htm)

So this is my code
Code:
Option Explicit

Private Function GetBetween(ByVal Start As Long, Data As String, _
    StartString As String, EndString As String, _
    Optional ByVal CompareMethod As VbCompareMethod = vbBinaryCompare) As String
    
    Dim lonStart As Long, lonEnd As Long
    
    '1. Find start string.
    lonStart = InStr(1, HTML, "<h1>", vbTextCompare)
    
    If lonStart > 0 Then
        '2. Move to end of start string.
        lonStart = lonStart + Len("<h1>")

        '3. Find end string.
        lonEnd = InStr(lonStart, HTML, "</h1>", vbTextCompare)
        
        If lonEnd > 0 Then
            '4. Extract data between start and end strings.
            GetBetween = Mid$(HTML, lonStart, lonEnd - lonStart)
            
            'Done!
        MsgBox GetBetween

        End If
    End If
    
End Function
Now how do I make it so that it know what site to go to and how do I also make it so that when I press "Command1" it will parse that information?
Reply With Quote
  #2  
Old 03-26-2011, 11:30 PM
Covey's Avatar
Creator of EliteSwitch
Ex-Moderator Visual Basic Programmers
 
Join Date: Sep 2005
Location: Fuckin' BAM!
Posts: 4,464
Default Re: [HELP] Parseing in vb6

You will need to add an Inet Control to your form and make sure it's called 'Inet1'.

Code:
Option Explicit

private sub command1_click()

    dim strhtml as string
    strhtml = inet1.openurl("http://help.nucleus.com/example_of_a_simple_html_page.htm")
    msgbox getbetween(1,strhtml,<h1>,</h1>)

end sub

Private Function GetBetween(ByVal Start As Long, Data As String, _
    StartString As String, EndString As String, _
    Optional ByVal CompareMethod As VbCompareMethod = vbBinaryCompare) As String
    
    Dim lonStart As Long, lonEnd As Long
    
    '1. Find start string.
    lonStart = InStr(1, data, startstring, comparemethod)
    
    If lonStart > 0 Then
        '2. Move to end of start string.
        lonStart = lonStart + Len(startstring)

        '3. Find end string.
        lonEnd = InStr(lonStart, data, endstring, comparemethod)
        
        If lonEnd > 0 Then
            '4. Extract data between start and end strings.
            GetBetween = Mid$(data, lonStart, lonEnd - lonStart)
        End If
    End If
    
End Function
__________________
EliteSwitch v4 Source Code - http://sythe.org/showthread.php?t=1214654
Reply With Quote
  #3  
Old 03-27-2011, 06:44 AM
Active Member
 
Join Date: May 2006
Posts: 122
Send a message via AIM to dgameman1 Send a message via MSN to dgameman1 Send a message via Skype™ to dgameman1
Default Re: [HELP] Parseing in vb6

Ok so now this is my whole code

Code:
Option Explicit

Private Sub command1_click()

    Dim strhtml As String
    strhtml = Inet1.OpenURL("http://help.nucleus.com/example_of_a_simple_html_page.htm")
    msgbox getbetween(1,strhtml,<h1>,</h1>)

End Sub
Private Function GetBetween(ByVal Start As Long, Data As String, _
    StartString As String, EndString As String, _
    Optional ByVal CompareMethod As VbCompareMethod = vbBinaryCompare) As String
    
    Dim lonStart As Long, lonEnd As Long
    
    '1. Find start string.
    lonStart = InStr(1, HTML, "<h1>", vbTextCompare)
    
    If lonStart > 0 Then
        '2. Move to end of start string.
        lonStart = lonStart + Len("<h1>")

        '3. Find end string.
        lonEnd = InStr(lonStart, HTML, "</h1>", vbTextCompare)
        
        If lonEnd > 0 Then
            '4. Extract data between start and end strings.
            GetBetween = Mid$(HTML, lonStart, lonEnd - lonStart)
            

        End If
    End If
    
End Function
Syntax error on
Code:
Private Sub command1_click()

    Dim strhtml As String
    strhtml = Inet1.OpenURL("http://help.nucleus.com/example_of_a_simple_html_page.htm")
    msgbox getbetween(1,strhtml,<h1>,</h1>)

End Sub
msgbox getbetween(1,strhtml,<h1>,</h1>) is red

Last edited by dgameman1 : 03-27-2011 at 06:47 AM.
Reply With Quote
  #4  
Old 03-27-2011, 10:58 AM
Covey's Avatar
Creator of EliteSwitch
Ex-Moderator Visual Basic Programmers
 
Join Date: Sep 2005
Location: Fuckin' BAM!
Posts: 4,464
Default Re: [HELP] Parseing in vb6

umm, VB6 might need an equal sign (=) after msgbox? i forget....

Code:
msgbox = getbetween(1,strhtml,<h1>,</h1>)
try that.
__________________
EliteSwitch v4 Source Code - http://sythe.org/showthread.php?t=1214654
Reply With Quote
  #5  
Old 03-27-2011, 08:10 PM
Active Member
 
Join Date: May 2006
Posts: 122
Send a message via AIM to dgameman1 Send a message via MSN to dgameman1 Send a message via Skype™ to dgameman1
Default Re: [HELP] Parseing in vb6

Rawrrr
This is my whole code
Code:
Option Explicit

Private Sub command1_click()

    Dim strhtml As String
    strhtml = Inet1.OpenURL("http://help.nucleus.com/example_of_a_simple_html_page.htm")
    msgbox = getbetween(1,strhtml,<h1>,</h1>)

End Sub
Private Function GetBetween(ByVal Start As Long, Data As String, _
    StartString As String, EndString As String, _
    Optional ByVal CompareMethod As VbCompareMethod = vbBinaryCompare) As String
    
    Dim lonStart As Long, lonEnd As Long
    
    '1. Find start string.
    lonStart = InStr(1, HTML, "<h1>", vbTextCompare)
    
    If lonStart > 0 Then
        '2. Move to end of start string.
        lonStart = lonStart + Len("<h1>")

        '3. Find end string.
        lonEnd = InStr(lonStart, HTML, "</h1>", vbTextCompare)
        
        If lonEnd > 0 Then
            '4. Extract data between start and end strings.
            GetBetween = Mid$(HTML, lonStart, lonEnd - lonStart)
            

        End If
    End If
    
End Function
Syntax error on
Code:
Private Sub command1_click()

    Dim strhtml As String
    strhtml = Inet1.OpenURL("http://help.nucleus.com/example_of_a_simple_html_page.htm")
    msgbox = getbetween(1,strhtml,<h1>,</h1>)

End Sub
msgbox = getbetween(1,strhtml,<h1>,</h1>) is red
Reply With Quote
  #6  
Old 03-27-2011, 09:04 PM
Covey's Avatar
Creator of EliteSwitch
Ex-Moderator Visual Basic Programmers
 
Join Date: Sep 2005
Location: Fuckin' BAM!
Posts: 4,464
Default Re: [HELP] Parseing in vb6

uhh whoops do this:
Code:
msgbox = getbetween(1,strhtml,"<h1>","</h1>")
__________________
EliteSwitch v4 Source Code - http://sythe.org/showthread.php?t=1214654

Last edited by Covey : 03-27-2011 at 09:07 PM.
Reply With Quote
  #7  
Old 03-27-2011, 09:22 PM
Active Member
 
Join Date: May 2006
Posts: 122
Send a message via AIM to dgameman1 Send a message via MSN to dgameman1 Send a message via Skype™ to dgameman1
Default Re: [HELP] Parseing in vb6

lolwtf

"Compile Error:
Function call on left-hand side of assignment must return Variant or Object"

My whole code

Code:
Option Explicit

Private Sub command1_click()

    Dim strhtml As String
    strhtml = Inet1.OpenURL("http://help.nucleus.com/example_of_a_simple_html_page.htm")
    MsgBox = GetBetween(1, strhtml, "<h1>", "</h1>")

End Sub
Private Function GetBetween(ByVal Start As Long, Data As String, _
    StartString As String, EndString As String, _
    Optional ByVal CompareMethod As VbCompareMethod = vbBinaryCompare) As String
    
    Dim lonStart As Long, lonEnd As Long
    
    '1. Find start string.
    lonStart = InStr(1, HTML, "<h1>", vbTextCompare)
    
    If lonStart > 0 Then
        '2. Move to end of start string.
        lonStart = lonStart + Len("<h1>")

        '3. Find end string.
        lonEnd = InStr(lonStart, HTML, "</h1>", vbTextCompare)
        
        If lonEnd > 0 Then
            '4. Extract data between start and end strings.
            GetBetween = Mid$(HTML, lonStart, lonEnd - lonStart)
            

        End If
    End If
    
End Function
Code:
Private Sub command1_click()

    Dim strhtml As String
    strhtml = Inet1.OpenURL("http://help.nucleus.com/example_of_a_simple_html_page.htm")
    MsgBox = GetBetween(1, strhtml, "<h1>", "</h1>")

End Sub
Private Sub command1_click() is yellow

Last edited by dgameman1 : 03-27-2011 at 09:22 PM.
Reply With Quote
  #8  
Old 03-28-2011, 02:23 AM
Covey's Avatar
Creator of EliteSwitch
Ex-Moderator Visual Basic Programmers
 
Join Date: Sep 2005
Location: Fuckin' BAM!
Posts: 4,464
Default Re: [HELP] Parseing in vb6

Remove the equal sign after the msgbox.... Dude you need to at least try instead of posting your errors and expecting others to fix them
__________________
EliteSwitch v4 Source Code - http://sythe.org/showthread.php?t=1214654
Reply With Quote
  #9  
Old 03-28-2011, 02:28 AM
Active Member
 
Join Date: May 2006
Posts: 122
Send a message via AIM to dgameman1 Send a message via MSN to dgameman1 Send a message via Skype™ to dgameman1
Default Re: [HELP] Parseing in vb6

Quote:
Originally Posted by Covey View Post
Remove the equal sign after the msgbox.... Dude you need to at least try instead of posting your errors and expecting others to fix them
But I don't exactly know what the error means.. so I don't know what to fix =O

This is variable unidentified

Code:
Private Function GetBetween(ByVal Start As Long, Data As String, _
    StartString As String, EndString As String, _
    Optional ByVal CompareMethod As VbCompareMethod = vbBinaryCompare) As String
is highlighted =O
Reply With Quote
  #10  
Old 03-28-2011, 12:02 PM
Covey's Avatar
Creator of EliteSwitch
Ex-Moderator Visual Basic Programmers
 
Join Date: Sep 2005
Location: Fuckin' BAM!
Posts: 4,464
Default Re: [HELP] Parseing in vb6

Quote:
Originally Posted by dgameman1 View Post
But I don't exactly know what the error means.. so I don't know what to fix =O

This is variable unidentified

Code:
Private Function GetBetween(ByVal Start As Long, Data As String, _
    StartString As String, EndString As String, _
    Optional ByVal CompareMethod As VbCompareMethod = vbBinaryCompare) As String
is highlighted =O
I can see the problem, i suggest you try looking for it.
I'll give you a hit, change one of your variable names to something the system doesn't already use.
__________________
EliteSwitch v4 Source Code - http://sythe.org/showthread.php?t=1214654
Reply With Quote
  #11  
Old 03-29-2011, 12:06 AM
Active Member
 
Join Date: May 2006
Posts: 122
Send a message via AIM to dgameman1 Send a message via MSN to dgameman1 Send a message via Skype™ to dgameman1
Default Re: [HELP] Parseing in vb6

So you're telling me that somewhere in
Code:
Private Function GetBetween(ByVal Start As Long, Data As String, _
    StartString As String, EndString As String, _
    Optional ByVal CompareMethod As VbCompareMethod = vbBinaryCompare) As String
is a variable that is not defined?
Reply With Quote
  #12  
Old 03-29-2011, 02:13 AM
Covey's Avatar
Creator of EliteSwitch
Ex-Moderator Visual Basic Programmers
 
Join Date: Sep 2005
Location: Fuckin' BAM!
Posts: 4,464
Default Re: [HELP] Parseing in vb6

Incorrect
__________________
EliteSwitch v4 Source Code - http://sythe.org/showthread.php?t=1214654
Reply With Quote
  #13  
Old 03-29-2011, 02:45 AM
Active Member
 
Join Date: May 2006
Posts: 122
Send a message via AIM to dgameman1 Send a message via MSN to dgameman1 Send a message via Skype™ to dgameman1
Default Re: [HELP] Parseing in vb6

Then why is that code highlighted?
Reply With Quote
  #14  
Old 03-29-2011, 10:31 AM
Covey's Avatar
Creator of EliteSwitch
Ex-Moderator Visual Basic Programmers
 
Join Date: Sep 2005
Location: Fuckin' BAM!
Posts: 4,464
Default Re: [HELP] Parseing in vb6

Quote:
Originally Posted by dgameman1 View Post
Then why is that code highlighted?
Because you are using a variable in that "GetBetween" function that isn't defined.....

You need to change one of the following variables:
Start
Data
StartString
EndString

to a variable you are using in your code, that you HAVEN'T declared....
If you can't work that out for yourself, i'm sorry but i'm not going to bother helping you...As i've already done 100% of what you were asking,..;
__________________
EliteSwitch v4 Source Code - http://sythe.org/showthread.php?t=1214654
Reply With Quote
  #15  
Old 03-30-2011, 12:23 AM
Hiatus's Avatar
Member
 
Join Date: Feb 2011
Posts: 29
Send a message via MSN to Hiatus
Default Re: [HELP] Parseing in vb6

He pretty much just fixed the problem for you. Another thing, why are you using vb6? Its so old.

/facepalm
__________________

Now selling CHEAP hosting! UNLIMITED SPACE for $10/month. ANYTHING IS ALLOWED.

Just drop me a PM with your email!

Vouches---

Quote:
Originally Posted by mskr93 View Post
Vouch for Hiatus.Sold him my pure acc name , trade went smooth , i went first , tyvm
Reply With Quote
  #16  
Old 06-14-2011, 06:54 AM
Newcomer
 
Join Date: Jun 2011
Posts: 16
Default Re: [HELP] Parseing in vb6

This is such A simple task.

Parsing one item from a site:
Code:
dim spSplit as string
spSplit = split(split(returnedData,"Tags Before")(Your delimeter example, 1"),"Tags After")(0)
Parsing more then one item:
Code:
dim sp() as string, i as long
sp() = split(returnedData,"Before Tags")
for i = 0 to ubound(sp())
sp(i) = split(sp(i),"After Tags")(0)

msgbox sp(i)

next i

Use:
Put it in your command button, make sure you name your objects.

Should work, I didn't open vb6 to test so...

Last edited by _trevaSaurus : 06-14-2011 at 06:55 AM.
Reply With Quote
Reply



Cheap RS Gold Store  Runescape Gold

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

All times are GMT +1. The time now is 10:53 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.6.1