[bb] Comment Box Generator by Baystep Productions [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:39

Previous topic - Next topic

BlitzBot

Title : Comment Box Generator
Author : Baystep Productions
Posted : 1+ years ago

Description : This wonderful doozy generates nice neat blitz comment boxes from inputed text files. Just run it through, select the input and output files and the character to build walls from.

On your input files just place "+separator+" on its own line to add a wall separator.

SIDE NOTE: Code archives messed up the comment spacing on the beginning example/legal it works much cleaner when executed.


Code :
Code (blitzbasic) Select
;////////////////////////////////////////////////////////////////
;//READ ME - (this was also generated by this program!)        //
;////////////////////////////////////////////////////////////////
;//Basicly....                                                 //
;//Save what you want commented in a txt file. Use the phrase  //
;//"+seperator+" on its own line to add a break in the comment //
;//box. Then supply an output file name. Choose 1 character to //
;//build the comment walls from. And let it go! Then copy the  //
;//output files contents and paste them in your code.          //
;//                     ENJOY ITS FREE - CHRIS PIKUL           //
;////////////////////////////////////////////////////////////////

Graphics 500,300,16,2
AppTitle "Build Me A Comment!"
Global inp_info$=Input("Text file to be commented: ")
Global out_info$=Input("Output B3D file for copy paste: ")
Global opt_char$=Left(Input("Character to build walls with: "),1)
Global wall$ = opt_char$+opt_char$
Type inline
Field txt$
End Type
Global iln.inline
Type outline
Field txt$
End Type
Global oln.outLine

file=ReadFile(inp_info$)
If Not file Then RuntimeError("Could not read input source!")
Print "Reading input file..."
Delay (500)
While Not Eof(file)
iln.inline = New inline
iln xt$ = ReadLine(file)
Wend
CloseFile(file)

Print "Building statistics..."
Delay (500)
Global max_width%=0
For iln.inLine = Each inLine
Local tmp_width%=Len(iln xt$)
If tmp_width%>max_width% Then max_width%=tmp_width%
Next

Print "Generating comments to memory..."
Delay (500)
oln.outLine=New outLine
oln xt$=String$(opt_char$,max_width%+4)
For iln.inLine = Each inLine
If Trim(Lower(iln xt$))="+separator+"
oln.outLine=New outLine
oln xt$=String$(opt_char$,max_width%+4)
Else
If Len(iln xt$)<max_width
iln xt$=iln xt$+String(" ",max_width-Len(iln xt$))
EndIf
oln.outLine=New outLine
oln xt$=wall$+iln xt$+wall$
EndIf
Next
oln.outLine=New outLine
oln xt$=String$(opt_char$,max_width%+4)

Print "Outputing saved comments..."
Delay (500)
file=WriteFile(out_info$)
For oln.outLine = Each outLine
WriteLine(file,";"+oln xt$)
Next
CloseFile(file)

Print "Finished! (closing in 3 seconds)"
Delay (3000)
End


Comments :


Ryan Burnside(Posted 1+ years ago)

 Please include and executable for those without blitzbasic.


Ryan Burnside(Posted 1+ years ago)

 Disregard the last post. I thought I was in the projects section.