Page 1 of 1 1
Topic Options
#84784 - 2002-01-03 02:24 PM BBCodeParser
Lonkero Administrator Offline
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
#84785 - 2002-01-03 02:25 PM Re: BBCodeParser
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ps.
if someone is little bit confused what's is this about, the start of this is foundable in script forum on topic BBCodeParser
_________________________
!

download KiXnet

Top
#84786 - 2002-01-03 02:49 PM Re: BBCodeParser
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
actually (this just hit me)...
If we are looking for good way to handle the code...
what if I code it with cgi?!?!?
sorry this suggestion does not include kix at all, just tcl...
you know, apache servers are really friendly for scripting and I might do cgi-script that does the same as this script, but without any outside programs.
then it would display the same resulting code in new browser window...
tcl isn't so simple anymore, so it would take some time, but we would get the same results without need for application downloads....

just a thougth...

_________________________
!

download KiXnet

Top
#84787 - 2002-01-03 04:59 PM Re: BBCodeParser
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
I was wondering if it was possible to just write an .htm script that displayed a textbox and an areabox and had a "get it" button. Then add a bit of vbscript or javascript to parse the code sections using DHTML ?

-Shawn

Top
#84788 - 2002-01-03 07:23 PM Re: BBCodeParser
Shawn Administrator Offline
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
#84789 - 2002-01-03 08:20 PM Re: BBCodeParser
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
execute() ! execute() !! execute() !!!

_________________________



Top
#84790 - 2002-01-03 11:56 PM Re: BBCodeParser
Alex.H Offline
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
#84791 - 2002-01-04 01:18 PM Re: BBCodeParser
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
there is this little problem.
If you do not have so much input to monitor kixforms polling is great.
but if switches grow up to 50 it could be pretty much easier to monitor with execute...
actually, it looks nice, almost c++ style functioning...
but for easiness, I'd go for polling.


but jpols seems to wait for some execution()'s...

_________________________
!

download KiXnet

Top
#84792 - 2002-01-09 01:56 PM Re: BBCodeParser
Lonkero Administrator Offline
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&copy 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,"&lt;") $p = instr($line,"&lt;") $line = substr($line,1,$p-1)+"<"+substr($line,$p+4,len($line)-($p+3))
else $che = $che+"1"
endif
if instr($line,"&gt;") $p = instr($line,"&gt;") $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 Administrator Offline
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
#84794 - 2002-01-09 02:26 PM Re: BBCodeParser
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
again back...
red this A new way of posting to this forum
and figured out that html-version for this tool has to be announced...
have to check it out. Even thou don't like to.

cheers,

_________________________
!

download KiXnet

Top
#84795 - 2002-01-15 09:51 AM Re: BBCodeParser
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
found the problem of the script.
boring to press 5000 times enter in debug until the failure occurs.
well, it indeed was not just quote mark but also variable naming inside a string.
now it's fixed and final from version 2.0 is put on the net later on today.
and shawn, if you have any time, you should try it.
code printing and saving tabs!!!
there is all I got from kiXforms together until this point.
_________________________
!

download KiXnet

Top
#84796 - 2002-01-15 03:51 PM Re: BBCodeParser
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
newist update (version 2.0) added to www-site:
http://www.gwspikval.com/jooel/scripts/BBCodeParser
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 781 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.062 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org