Announcement

Collapse
No announcement yet.

Reading a text file from a http site

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reading a text file from a http site

    Hello All,
    Has anyone parsed a text file from a http site? Its basically a text file but just stored an http.

    The info on the web url looks like this:
    BREAKING | NEWS
    BREAKING | OVERNIGHT
    DEVELOPING | STORY
    ELECTION | 2020

    I have done a text file from a file location but cant get the syntax to read it from an http.

    Thanks in advance,
    Shotski

  • #2
    I found the solution

    Comment


    • #3
      Dear Sir,

      How You Solved and what is the solution

      Comment


      • #4
        Hi Mallela,

        It was solved this way. The first script below goes to a website that holds the text file and then parses it into a drop down list. The second script is tied to the drop down list and pushes the data to different text fields. Let me know if this helps.

        '-----------------Loads text file data-----------------

        sub loadData(Sender)

        set xmlhttp = createobject ("msxml2.xmlhttp.3.0")
        xmlhttp.open "get", "http://IP address here/textfilehere.txt" , false
        xmlhttp.send
        strOutput = split(xmlhttp.responseText,"")(0)

        'msgbox strOutput
        data = strOutput


        'filename = "ConvoHeader.txt"
        ' Clear the data
        TopicSelect.Items.Clear
        TopicSelect.Items.add "Choose Header..."
        TopicSelect.ItemIndex = 0

        ' Add all lines as items in drop down list
        dim lines
        lines = Split(data, VbCrLF)
        For i=0 to UBound(lines)
        TopicSelect.Items.Add(lines(i))
        Next

        End sub

        '-------This splits data to different tab fields-------
        Sub TopicSelectSelect(Sender)
        ' Set the 2 fields based on the string passed from the TopicSelect item.
        ' String is Split on delimiter

        ' Clear the fields
        TopicText1.UTF8Text = ""
        TopicText2.UTF8Text = ""

        dim splits

        if sender.UTF8Text="" then
        TopicText1.UTF8Text = ""
        TopicText2.UTF8Text = ""
        Else
        splits = Split(sender.UTF8Text, " | ")

        ' Check we have at least two values - or an index out of bounds error will be thrown
        if ubound(splits) >= 1 then
        TopicText1.UTF8Text = splits(0)
        TopicText2.UTF8Text = splits(1)
        else
        TopicText1.UTF8Text = splits(0) ' This will be whole line.
        end if
        End if

        End sub

        Comment

        Working...
        X