Parse HTML Files

Category: Jose Roca

Date: 02-16-2022

Return to Index


 
'Compilable Example:  (Jose Includes)
#Compile Exe
#Dim All
%Unicode = 1
#Include "MSHTML.INC"  '<--- Jose Roca include
%IDC_GetText    = 1002
 
Function PBMain
   Local hDlg As Dword
   Dialog New Pixels, 0, "Batch HTML Extract", , , 300, 200, %WS_OverlappedWindow To hDlg
   Control Add Button, hDlg, %IDC_GetText, "Get Text", 10,10,75,20
   Dialog Show Modal hDlg, Call DlgProc
End Function
 
CallBack Function DlgProc() As Long
   Select Case CbMsg
      Case %WM_Command
         Select Case Cb.Ctl
            Case %IDC_GetText
               Local fName$, HTMLText$, temp$, pDoc As IHTMLDocument2
               pDoc = NewCom ClsId $CLSID_HTMLDocument
               fName$ = Dir$("*.htm")
               While Len(fName$)
                  fName$ = Exe.Path$ + fName$
                  Open fName$ For Binary As #1 : Get$ #1, Lof(1), temp$ : Close #1
                  IHTMLDocument2_WriteString(pDoc, temp$)
                  pDoc.Close
                  HTMLText$ = HTMLText$ + $CrLf + pDoc.body.innerText
                  fName$ = Dir$(Next)
               Wend
               ? HTMLText$
         End Select
   End Select
End Function
 
'gbs_01329
'Date: 05-11-2013      


created by gbSnippets
http://www.garybeene.com/sw/gbsnippets.htm