Results 1 to 4 of 4

Thread: Convert HTML Text to Regular Text..Please help

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2002
    Location
    Enkrypted Networks
    Posts
    14

    Convert HTML Text to Regular Text..Please help

    Okay, I have the logs of AIM Conversations [ I'm making an AIM Logger], and I would like for the logs to be plain text - But the AIM Window has them as HTML, How do I take all the HTML Out And just have it plain, so its nice and plain in notepad? MUCH thanks
    Learning & Understanding the REAL meaning of zero's and one's.

  2. #2
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654
    Here is a code made by me:

    VB Code:
    1. Dim A As Long, B As Long, Buffer As String, Temp As String
    2.     On Error Resume Next
    3.     Buffer = Teksti.Text
    4.     A = InStr(Buffer, "<")
    5.     Do While A 'remove the tags
    6.         DoEvents
    7.         B = A
    8.         A = InStr(Buffer, ">")
    9.         If A = 0 Then Exit Do
    10.         Temp = LCase(Mid(Buffer, B, A - B + 1))
    11.         If Temp Like "<br>" Or Temp Like "</h1>" Or Temp Like "</h2>" Or Temp Like "</h3>" Or Temp Like "</h4>" Or Temp Like "</h5>" Or Temp Like "</h6>" Or Temp Like "<hr>" Or Temp Like "<p>" Then
    12.             Buffer = Left(Buffer, B - 1) & vbCrLf & Right(Buffer, Len(Buffer) - A)
    13.         Else
    14.             Buffer = Left(Buffer, B - 1) & Right(Buffer, Len(Buffer) - A)
    15.         End If
    16.         A = InStr(Buffer, "<")
    17.     Loop
    18.     A = InStr(Buffer, vbCrLf & vbCrLf)
    19.     Do While A 'remove too many enters
    20.         DoEvents
    21.         Buffer = Left(Buffer, A) & Right(Buffer, Len(Buffer) - A - Len(vbCrLf))
    22.         A = InStr(Buffer, vbCrLf & vbCrLf)
    23.     Loop
    24.     Teksti.Text = Buffer


    As for where Teksti is a TextBox / RichTextBox You can do more validating by yourself (I'm not sure what all AIM has). Anyways, I hope this helps!

  3. #3
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228
    Use this link!
    Strip HTML tags

    Cheers!
    Abhijit
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  4. #4

    Thread Starter
    New Member
    Join Date
    Aug 2002
    Location
    Enkrypted Networks
    Posts
    14

    Thanks

    Thanks alot
    Learning & Understanding the REAL meaning of zero's and one's.

Posting Permissions

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



Click Here to Expand Forum to Full Width