#89094 - 2002-10-31 07:31 AM
BBCodeParser - late night update
|
Lonkero
KiX Master Guru
   
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
I've been thinking of updating the codeparser but somehow have not done that... this time did some work. it's not perfect but now it seems to work.
eh, for the once who don't know what this is: running it and giving a topic address it gives you all the codes in that topic. with correct layout and ability to save or print and so on. so called easy access... code:
; ; BBCodeParser - KiXtart Bulleting Board Code Parser ; ; Dependencies: ; Wkix32 - KiXtart 4.12 ; kixforms.dll - KiXForms (version 2.1.1) ; ; -Lonkero ; ; 3.1.1.4 main improvements: ; removed the winhttp from dependencies ; improved parsing ; removed the status display ; $VERSION = "3.1.1.7" $CRLF = @crlf
$form = createobject("kixtart.form") $form.caption = "BBCodeParser" $form.width = $form.screen.width-100 $form.height = 530 $form.center $form.font.name = "arial" $form.font.size = 20 $form.forecolor = $form.rgb(200,200,200) $form.printxy(8,6,"BBCodeParser") $form.forecolor = $form.rgb(51,153,255) $form.printxy(6,4,"BBCodeParser") $form.font.size = 10 $form.font.bold = 1 $form.printxy(185,6,"$VERSION") $form.font.name = "arial" $form.font.size = 10 $form.forecolor = 0 $form.font.bold = 0 $form.printxy(8,48,"Topic:")
$address = $form.textbox $address.top = 45 $address.left = 55 $address.width = $form.width-250 $address.height = 20 $address.text = ""
$download = $form.commandbutton $download.caption = "Download!" $download.top = 42 $download.left = $form.width-175 $download.width = 75 $download.height = 25 $download.onclick = '$$=download() $$edit.text="Choose the script from left panel." $$save.enabled=1 $$print.enabled=1' $download.fontbold = 0 $download.default = 1
$edit = $form.textbox $edit.multiline = 1 $edit.scrollbars=3 $edit.wordwrap=0 $edit.top = 85 $edit.left = 215 $edit.width = $form.width - 220 $edit.height = 365 $edit.text = "Enter the URL of the page you want to retrieve code from to topic field and click download@crlfhint: easiest way is to cut'n paste it from your webbrowser!"
$index = $form.listbox $index.top = 85 $index.left = 5 $index.width = 200 $index.height = $form.height - 120 $index.onclick = '$$edit.text = $$code[$$index.listindex]'
$save = $form.commandbutton $save.top = 465 $save.left = 215 $save.width = 75 $save.height = 25 $save.caption = "Save" $save.onclick = "$$=save($$form.filesavedialog)" $save.enabled = 0
$print = $form.commandbutton $print.top = 465 $print.left = 310 $print.width = 75 $print.height = 25 $print.caption = "Print" $print.onclick = "$$=print()" $print.enabled = 0
$about = $form.commandbutton $about.top = 465 $about.left = $form.width-270 $about.width = 75 $about.height = 25 $about.caption = "About" $about.onclick = "$$=TkAboutBox($$VERSION)"
$exit = $form.commandbutton $exit.top = 465 $exit.left = $form.width-175 $exit.width = 75 $exit.height = 25 $exit.caption = "Exit" $exit.onclick = "$$form.visible=0" $exit.cancel = 1
$form.show while $form.visible $=execute($form.doevents) loop
exit 1
function download() dim $data,$,$c,$httpObj if not instr($address.text,"kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic") $ = messagebox("You didn't give kixBB url-address. This script supports only BB found at kixtart.org!","Usage error",48) return else $page="http://kixtart.org/cgi-bin/ultimatebb.cgi?ubb=print_topic"+substr($address.text,instr($address.text,"?ubb=")+14) endif
$httpObj = createobject("microsoft.xmlhttp") $httpObj.open("GET",$page,not 1) $httpObj.send() $data=$httpObj.Responsetext $data=split($data,'<hr />Posted by <b>') for $=0 to ubound($data) $data[$]=split($data[$],'>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">') if ubound($data[$]) $data[$][0]=left($data[$][0],instr($data[$][0],"</b>")-1) for $c=1 to ubound($data[$]) $index.additem($data[$][0]+" (post #"+$+")") $data[$][$c]=left($data[$][$c],instr($data[$][$c],"</pre><hr />")-1) if instr($data[$][$c],"<") $data[$][$c]=join(split($data[$][$c],"<"),"<") endif if instr($data[$][$c],">") $data[$][$c]=join(split($data[$][$c],">"),">") endif if instr($data[$][$c],""") $data[$][$c]=join(split($data[$][$c],"""),chr(32)) endif if instr($data[$][$c],"<br />") $data[$][$c]=join(split($data[$][$c],"<br />"),@crlf) endif $code=$code+$data[$][$c]+chr(7) next endif next $code=split($code,chr(7)) endfunction
Function TkAboutBox($Version) $former = createobject("kixtart.form") $former.scalewidth = 500 $former.scaleheight = 180 $former.center $former.caption = "About "+$name $former.fontname = "times new roman" $former.fontsize = 14 $former.fontbold = 1 $former.printxy(10,20,"BBCodeParser") $former.fontsize = 8 $former.fontbold = 0 $former.printxy(10,40,"version "+$Version) $former.fontsize = 12 $former.fontbold = 1 $former.printxy(10,60,"created and authored since 2001 By Lonkero") $former.fontsize = 10 $former.fontbold = 0 $former.printxy(20,100,"Special thanks of bringing us kixforms and of great help to Shawn.") $former.printxy(40,120,"Thanks to also Ruud who has given us kiXtart!") $oker = $former.commandbutton $oker.onclick = "$$former.visible=0" $oker.center $oker.top = 150 $oker.left = 400 $oker.width = 75 $oker.height = 25 $oker.caption = "OK" $former.visible=1 while $former.doevents = 1 loop $former=0 EndFunction
function save($file) dim $ if len($file) del $file $=open(1,$file,5) $=writeline(1,"; "+$index.text+" from topic "+$address.text+@crlf+@crlf) $=writeline(1,$edit.text) $=writeline(1,"@crlf@crlf; brought to you by BBCodeParser "+$VERSION+@crlf) $=close(1) $= $$form.msgbox("Code saved In:@crlf"+$file,"note",64) endif endfunction
function print() dim $formi,$ $formi = createobject("kixtart.form") $formi.caption = "BBCodeParser"+$VERSION+" by Lonkero" $formi.width = 450 $formi.height = 100 $formi.center $formi.fontbold = 1 $formi.printxy(10,10,"Printing in Progress...") $formi.visible = 1 sleep 1 $=open(1,"%temp%\BBCodeParser "+$VERSION,5) $=writeline(1,"code:"+$index.text+" from topic "+$address.text+@crlf+@crlf) $=writeline(1,$line) $=close(1) shell "notepad /p %temp%\BBCodeParser "+$VERSION sleep 1 del "%temp%\BBCodeParser "+$VERSION endfunction
[ 31. October 2002, 08:13: Message edited by: Lonkero ]
_________________________
!download KiXnet
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
1 registered
(mole)
and 1300 anonymous users online.
|
|
|