#84784 - 2002-01-03 02:24 PM
BBCodeParser
|
Lonkero
KiX Master Guru
   
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
as you wish Shawn, as you wish...I had my BBCodeparser indeed use ie in the pre public versions, but it hanged too much and didn't work properly. then I found that best way is not let IE understand any of the stuff that is going on and I made dir() to scan all IE tempfiles and take the right one. it was too slow. with winhttp I have not experienced any of these problems, cause it just simple get's the source and does not interprete it. I have experienced with pre finals of winhttp sdk 5.0 some problems, with bbchecker thou... problems has occured when same page has been transferred about 250 times. I think your script is fine, but as you stated, it's not reliable. and I was looking for kixOnly solution with maybe some help from outside dll's like kiXforms and winhttp5. but, is this, what I'm lacking in my script, possible: to have kiXforms have textbox or frame which is scrollable on both dimensions? cheers and thanks for your insight,
_________________________
!download KiXnet
|
|
Top
|
|
|
|
#84788 - 2002-01-03 07:23 PM
Re: BBCodeParser
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
Lonkero,You've had a chance to play with kixforms ... what's your opinion of the polling for event strategy as opposed to the execute event strategy ... kixforms uses the polling technique, eg: while $form.getevent if $button.click ?"hi there" endif loop kixwinvb uses the execute strategy: $button.onclick = "button_click()" while $form.visible $=execute($form.getevent()) loop function button_click() ?"hi there" endfunction any thoughts ? -Shawn
|
|
Top
|
|
|
|
#84790 - 2002-01-03 11:56 PM
Re: BBCodeParser
|
Alex.H
Seasoned Scripter
Registered: 2001-04-10
Posts: 406
Loc: France
|
OMG!!! I'd better be carefull to what i'll do on KixwinVB or jpols will execute() me  Or should I say : Execute($Me)lol [ 04 January 2002: Message edited by: Alex.H ]
_________________________
? getobject(Kixtart.org.Signature)
|
|
Top
|
|
|
|
#84792 - 2002-01-09 01:56 PM
Re: BBCodeParser
|
Lonkero
KiX Master Guru
   
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
newest version, which has problem with quote-marks. As I understood, it's not execute() but kixforms listbox'es additem()-related failure.BB didn't accept it so added it here as text:
; ; BBCodeParser.kix - KiXtart Bulleting Board Code Parser version 2.0 beta2 ; ; Dependencies: ; KiXtart 4.01 or later ; KiXForms (build 4) ; Winhttp SDK 5.0 ; ; -Lonkero ; $ = setconsole("hide") break on del "%temp%\*.bbcp" go "%systemdrive%" cd "\" gosub "question" $form = createobject("kixtart.form") $form.caption = "BBCodeParser 2.0 by Lonkero" $form.width = $form.screenwidth - 100 $form.height = $form.screenheight - 200 $form.left = 50 $form.top = 30 $form.fontsize = 10 $form.moveto(10,10) $form.print("Code's Retrieved from topic:") $form.fontbold = 1 $form.moveto(200,10) $form.print("$page") $saveb = $form.commandbutton(150,$form.height-70,150,25,"SAVE this one") $printb = $form.commandbutton($form.width -300,$form.height-70,150,25,"PRINT this one") $form.fontbold = 0 $form.fontname = "Arial Black" $index = $form.listbox(5,40,100,$form.height - 110,"") $form.fontsize = 8 $form.fontname = "Arial" gosub "retrieve" $this = 0 $code0.visible = 1 $form.visible = 1 while $ = $form.getevent() select case $index.click $ = execute('$$code$this.visible = 0') $this = val(substr($index.text,6,1))-1 $ = execute('$$code$this.visible = 1') case $printb.click gosub "print" case $saveb.click gosub "save" endselect loop del "%temp%\*.bbcp" exit
:question $formQ = createobject("kixtart.form") $formQ.caption = "BBCodeParser 2.0 by Lonkero" $formQ.width = 450 $formQ.height = 100 $formQ.left = 100 $formQ.top = 100 $formQ.moveto(10,0) $formQ.fontbold = 1 $formQ.print("Place Here the URL of the page you want to retrieve code from") $formQ.fontbold = 0 $pageQ = $formQ.textbox(10,20,350,20,"") $formQ.fontbold = 1 $buttonQ = $formQ.commandbutton(370,20,50,20,"Get It!") $formQ.moveto(10,50) $formQ.fontbold = 0 $formQ.print("Tip: easily done with cut© from your webbrowser's addressbar") $formQ.visible = 1 do $ = $formQ.getevent() until $buttonQ.click() $page = $pageQ.caption $formQ.visible = 0 $formQ = 1 if not instr($page,"http://kixtart.org/cgi-bin/ultimatebb.cgi?") $ = messagebox("You didn't give kixBB url-address. This script supports only BB found at kixtart.org!","Usage error",48) exit endif return :retrieve $formr = createobject("kixtart.form") $formr.caption = "BBCodeParser 2.0 by Lonkero" $formr.width = 300 $formr.height = 150 $formr.left = ($formr.screenwidth - $formr.width)/2 $formr.top = ($formr.screenheight - $formr.height)/2 $formr.fontsize = 8 $formr.fontbold = 0 $formr.visible = 1 $formr.moveto(10,0) $formr.print("page Retrieval...") $formr.fontsize = 10 $formr.fontbold = 1 $formr.moveto(30,20) $formr.print("Starting Winhttp...") $httpObj = createobject("winhttp.winhttprequest.5") if vartype($httpObj) <> 9 ? $ = messagebox("failed to start Winhttp, quitting...","Subsystem Error",16) exit else $formr.moveto(50,40) $formr.print("WinHTTP Started") endif $httpObj.open("GET",$page) ? if @error $ = messagebox("failed to Initialize Winhttp ( error:@serror ), quitting...","Subsystem Error",16) exit else $formr.moveto(50,60) $formr.print("WinHTTP initialized") endif $httpObj.send() $crlf = chr(13)+chr(10) $i=0 $data = $httpObj.Responsetext $formr.moveto(30,80) $formr.print("Page Transferred") $formr.moveto(10,100) $formr.print("Parsing Data...") $x = instr($data,">code:</font><HR><pre>") while $x <> 0 $data = substr($data,$x+22,len($data)-($x+21)) $x = instr($data,"</pre>") - 1 $post = substr($data,1,$x) $index.additem("code "+($i+1),$i) $ = open(1,"%temp%\code "+($i+1)+".bbcp",5) $ = writeline(1,"$page"+$crlf+$crlf) $ = execute('$$code$i = $$form.listbox(110,40,$$form.width - 120,$$form.height - 60,"")') $ = execute('$$code$i.visible = 0') $c=0 for each $section in split($post,"<P>") for each $line in split($section,"<BR>") do $che = "" if instr($line,"<") $p = instr($line,"<") $line = substr($line,1,$p-1)+"<"+substr($line,$p+4,len($line)-($p+3)) else $che = $che+"1" endif if instr($line,">") $p = instr($line,">") $line = substr($line,1,$p-1)+">"+substr($line,$p+4,len($line)-($p+3)) else $che = $che+"1" endif until $che = "11" $ = execute('$$code$i'+'.additem("$line",$c)') $ = writeline(1,"$line"+$crlf) $c=$c+1 next next $ = writeline(1,""+$crlf+"By BBCodeParser 2.0"+$crlf) $ = close(1) $x = instr($data,">code:</font><HR><pre>") $i=$i+1 loop $formr.moveto(120,100) $formr.print("Done") sleep 1 $formr.visible = 0 $formr = 1 return :save $formQ = createobject("kixtart.form") $formQ.caption = "BBCodeParser 2.0 by Lonkero" $formQ.width = 450 $formQ.height = 100 $formQ.left = 100 $formQ.top = 100 $formQ.moveto(10,0) $formQ.fontbold = 1 $formQ.print("Give path (optional) and filename for this script") $formQ.fontbold = 0 $fileQ = $formQ.textbox(10,20,350,20,"") $formQ.fontbold = 1 $buttonQ = $formQ.commandbutton(370,20,50,20,"Save It!") $formQ.moveto(10,50) $formQ.fontbold = 0 $formQ.print("note: Omitting the path will save file in %systemdrive%\") $formQ.visible = 1 $close = 0 while $formQ.getevent() and $close = 0 if $buttonQ.click() copy "%temp%\code "+($this+1)+".bbcp" "$fileQ.caption" $close = 1 endif loop $formQ.visible = 0 $formQ = 1 return :print $formi = createobject("kixtart.form") $formi.caption = "BBCodeParser 2.0 by Lonkero" $formi.width = 450 $formi.height = 100 $formi.left = ($formi.screenwidth - 450)/2 $formi.top = ($formi.screenheight - 100)/2 $formi.moveto(100,45) $formi.fontbold = 1 $formi.print("Printing in Progress...") $formi.visible = 1 sleep 1 shell "notepad /p %temp%\code "+($this+1)+".bbcp" $formi.visible = 0 $formi = 1 return
[ 09 January 2002: Message edited by: Lonkero ]
_________________________
!download KiXnet
|
|
Top
|
|
|
|
#84793 - 2002-01-09 02:11 PM
Re: BBCodeParser
|
Lonkero
KiX Master Guru
   
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
shawn, as you see have gone around the cut & select & copy issue by giving opportunity to save and print directly. but still the areabox is needed and waited upon. until, I'll stick with betas. after, I'll plan on making installation package.and, because bb is poor on accepting html, this issue should be solved before I can land the final. btw, as you see, I don't like IE. that's why I don't want to do this with it. so far, for all the functions to work, the files needed are as listed: kix32.exe kixforms.dll winhttp5.dll notepad.exe where the exe's are obvious in win-based machine. cheers,
_________________________
!download KiXnet
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 484 anonymous users online.
|
|
|