; ID: 2189 ; Author: Nebula ; Date: 2008-01-20 12:08:37 ; Title: Html table ripper (b+) ; Description: Copy table skeleton from html text files. ; ; HTML custom Table generator and Webpage structure ripper. By Nebula/Crom Design in 2003 ; ; ; Dim brik$(6024) Dim countdown(10) Dim keywords$(10) ;Include "commands.bb" If CommandLine$() = "runfromeditor" Then ChangeDir("d:\blitzbasic\blitzplustutorials\") Global f ; Is used for files Global Textfield winwidth = 640 winheight = 200 rows = 2 columns = 2 win = CreateWindow("TableGenerator and HTML structure ripper - By Nebula in 2003",Desktopcenterx()-winwidth/2,Desktopcentery()-winheight/2,640,200,Desktop(),1+8) htmlviewer = CreateHtmlView(320,0,winwidth/2,winheight,win) ; button1 = CreateButton("Rip Webstructure",0,0,150,20,win) SetGadgetLayout button1,1,1,1,1 button2 = CreateButton("Generate Table",0,20,150,20,win) SetGadgetLayout button2,1,1,1,1 tx1 = CreateTextField(150,20,30,20,win) ;SetGadgetLayout txt1,1,1,1,1 tx2 = CreateTextField(180,20,30,20,win) ;SetGadgetLayout txt2,1,1,1,1 Textfield = CreateTextArea(0,40,640-320-5,100,win) ;SetGadgetLayout textfield1,1,1,1,1 AddTextAreaText Textfield,"Place html source code in here and press Rip WebStructure." SetStatusText win,CurrentDir() While we<>$803 we = WaitEvent() Select we Case $401 If EventSource() = button1 Then ripstructure HtmlViewGo htmlviewer,CurrentDir()+"test.html" End If If EventSource() = button2 Then a = TextFieldText(tx1) b = TextFieldText(tx2) If a>0 And a<100 Then If b>0 And b<100 Then createtablefile("tablefile.html",a,b) HtmlViewGo htmlviewer,CurrentDir()+"tablefile.html" Else Notify "incorrect rows" End If Else Notify "incorrect collumns" End If End If End Select Wend End Function Ripstructure() keywords(0)="
0 Then
For ii=za To za+12
zb$ = Mid(a$,ii,1)
If zb$="0" Then
zb$=Left(a$,ii-1)
zc$="1"
zd$=Right(a$,Len(a$)-ii)
a$=zb$+zc$+zd$
Exit
End If
Next
End If; |
0 Then a$ = Stradd(a$,"width = " + Chr(34) + width + "%"+Chr(34) + " ") If width <> 0 Then a$ = Stradd(a$,"height = " + Chr(34) + height + "%"+Chr(34) + " ") If background$ <> "" Then a$ = Stradd(a$,"background = " + Chr(34) + background$ + Chr(34) + " ") If bgcolor$ <> "" Then a$ = Stradd(a$,"bgcolor = " + Chr(34) + bgcolor$ + Chr(34) + " ") a$=a$+"> " + inhoud$ ; Return a$ ; End Function Function createtablerow$(width=0,height=0,bgcolor$="0") a$ = a$ + " |
" CloseFile(f) End Function Function createtablefile(filename$,rows,columns) f = WriteFile(filename$) ; createhtmlheader(f) ; ; WriteLine(f,createtable$(100,"center",1)) ; For x=1 To rows WriteLine(f,createtablerow$()) For y=1 To columns WriteLine(f,createtabledata(" ")) WriteLine(f,"") Next WriteLine(f,"") Next ; WriteLine(f,"") ; WriteLine(f,a07$) ; CloseFile(f) ; If FileType(filename$) <> 1 Then a$ = CurrentDir$() Notify "Could not create file : " + a$ + filename$ End If End Function Function createhtmlheader(file) a01$ = "" a02$ = "
" a03$ = "" a04$ = "" a05$ = "" a06$ = "