Hi -- I found this code here. If this code works it would be fantastic!
I am not a coder. I recently had to move my board from ProBoards to InvisionFree. IF does not read the [center][/center] BBCode and this is a problem for me. I publish fiction on my board and I would have to manually change the 'centering' code for hundreds of threads.
I'm pretty good at getting code to work if someone can tell be where this code needs to be placed.
This will convert BBCode (Bulletin Board Code) to HTML
For Example:
Code:
[b]bold text[/b]
[url]http://www.google.co.uk[/url]
[url=http://www.aol.com]AOL[/url]
will be converted to
Code:
<b>bold text</b>
<a href="http://www.google.com">http://www.google.co.uk</a>
<a href="http://www.aol.com">AOL</a>
I have also made a version that used a GUI made in VB to display the results instead of internet explorer which you can get here-
http://hometown.aol.co.uk/JRMC137/BBCod ... e2HTML.zipCode:
Gui -theme
addcontrols:
Gui, Add, Button, x446 y145 w64 h24 gPaste, Paste
Gui, Add, Button, x446 y175 w64 h24 gSubmit, Submit
Gui, Add, Button, x446 y205 w64 h24 gExit, Exit
Gui, Add, Edit, x16 y30 w420 h200 vcanned,
Gui, Add, Text, x16 y10 w170 h20, Enter or Paste the BBCode Below:
Gui, Show, h241 w522, BBCode to HTML Converter
Return
Exit:
GuiClose:
ExitApp
Paste:
ControlSetText, Edit1,, BBCode to HTML Converter
Control, EditPaste, %clipboard%, Edit1, BBCode to HTML Converter
return
Submit:
gui, submit
if canned=
{
filedelete, canned.txt
fileappend,No text Found,canned.txt
Exitapp
}
filedelete, canned.txt
fileappend,%canned%,canned.txt
filedelete, html.htm
autotrim, off
Loop, read, canned.txt, html.htm
{
bbcode=%A_LoopReadLine%
ifinstring, bbcode,[code]
addspaces=1
ifinstring, bbcode,[/code]
addspaces=2
if addspaces=1
{
stringReplace, bbcode, bbcode, %a_tab%,  `; `; `;, All
ifinstring,bbcode ,%a_space%%a_space%%a_space%
StringReplace, bbcode, bbcode, %a_space%%a_space%%a_space%,  `; `; `;, All
else
ifinstring,bbcode ,%a_space%%a_space%
StringReplace, bbcode, bbcode, %a_space%%a_space%,  `; `;, All
}
StringReplace, bbcode, bbcode, [img], <img src=, All
StringReplace, bbcode, bbcode, [/img], >, All
;-------------------------------------------------------------Changes Font sizes
ifinstring, bbcode, [size=
{
StringSplit, size_array, bbcode, ]
Loop, %size_array0%
{
StringTrimLeft, this_size, size_array%a_index%, 0
ifinstring, this_size, [size
{
stringreplace, this_size, this_size, [size=,
StringRight, this_size, this_size, 2
this_size=%this_size%
stringreplace, bbcode, bbcode, %this_size%],
if this_size between 0 and 8
this_size = 1
if this_size between 9 and 10
this_size = 2
if this_size between 11 and 12
this_size = 3
if this_size between 13 and 14
this_size = 4
if this_size between 15 and 18
this_size = 5
if this_size between 19 and 24
this_size = 6
if this_size >= 25
this_size = 7
stringreplace, bbcode, bbcode, [size=,<font size = "%this_size%">
}
}
}
;-------------------------------------------------------------Changes e-mail
ifinstring, bbcode, [email]
{
StringSplit, email_array, bbcode, ]
Loop, %email_array0%
{
StringTrimLeft, this_email, email_array%a_index%, 0
ifinstring, this_email, [/email
{
stringreplace, this_email, this_email, [/email,
stringreplace, bbcode, bbcode, [email],<a href="mailto:%this_email%">
}
}
}
StringReplace, bbcode, bbcode, [email=, <a href=, All
stringreplace, bbcode, bbcode,[/email], </a>, all
;-------------------------------------------------------------Aligns text
StringReplace, bbcode, bbcode, [center], <div align="center">, All
StringReplace, bbcode, bbcode, [/center], </div>, All
StringReplace, bbcode, bbcode, [left], <div align="left">, All
StringReplace, bbcode, bbcode, [/left], </div>, All
StringReplace, bbcode, bbcode, [right], <div align="right">, All
StringReplace, bbcode, bbcode, [/right], </div>, All
;Change table font colours
;-------------------------------------------------------------Changes URL with and without =
ifinstring, bbcode, [url]
{
StringSplit, word_array, bbcode, ]
Loop, %word_array0%
{
StringTrimLeft, this_word, word_array%a_index%, 0
ifinstring, this_word, [/url
{
stringreplace, this_word, this_word, [/url,
stringreplace, bbcode, bbcode, [url],<a href="%this_word%">
}
}
}
StringReplace, bbcode, bbcode, [url=, <a href=, All
StringReplace, bbcode, bbcode, [/url], </a>, All
;-------------------------------------------------------------Other font options
StringReplace, bbcode, bbcode, [s], <strike>, All
StringReplace, bbcode, bbcode, [/s], </strike>, All
StringReplace, bbcode, bbcode, [font=, <font face=, All
StringReplace, bbcode, bbcode, [size=, <font size=, All
StringReplace, bbcode, bbcode, [/size], </font>, All
StringReplace, bbcode, bbcode, [color=, <font color=, All
StringReplace, bbcode, bbcode, , </font>, All
StringReplace, bbcode, bbcode, [b], <b>, All
StringReplace, bbcode, bbcode, [/b], </b>, All
StringReplace, bbcode, bbcode, [i], <i>, All
StringReplace, bbcode, bbcode, [/i], </i>, All
StringReplace, bbcode, bbcode, [u], <u>, All
StringReplace, bbcode, bbcode, [/u], </u>, All
StringReplace, bbcode, bbcode, [i], <i>, All
StringReplace, bbcode, bbcode, [/i], </i>, All
;-------------------------------------------------------------Lists
StringReplace, bbcode, bbcode, [list], <ul>, All
StringReplace, bbcode, bbcode, [list=1], <ol>, All
StringReplace, bbcode, bbcode, [list=i], <ol type="I">, All
StringReplace, bbcode, bbcode, [list=a], <ol type="a">, All
StringReplace, bbcode, bbcode, [/list], </ul>, All
ifinstring, bbcode, [*]
{
StringReplace, bbcode, bbcode, [*], <li>, All
bbcode=%bbcode%</li>
}
;-------------------------------------------------------------Code and Quotes with tables
StringReplace, bbcode, bbcode, [code], <table bgcolor="#FAFCFE" align="center" width="95`%" border="1"><tr
bgcolor="#FDDBCC"><td><b>Code:</b></td></tr><tr><td><font color="#008000">, All
StringReplace, bbcode, bbcode, [/code], </font></td></tr></table>, All
StringReplace, bbcode, bbcode, [quote], <table bgcolor="#FAFCFE" align="center" width="95`%" border="1"><tr
bgcolor="#E8EFF7"><td><b>Quote:</b></td></tr><tr><td>, All
StringReplace, bbcode, bbcode, [/quote], </td></tr></table>, All
;needs to be last item
ifinstring, bbcode, [quote`=
{
StringReplace, bbcode, bbcode, [quote`=, <table bgcolor="#FAFCFE" align="center" width="95`%" border="1"><tr
bgcolor="#E8EFF7"><td><b>Quote:%a_space%</b>
StringReplace, bbcode, bbcode, [/quote], </td></tr></table>, All
StringReplace, bbcode, bbcode, ], </td></tr><tr><td>
}
;-------------------------------------------------------------Replace brackets and append to file
StringReplace, bbcode, bbcode, [, <, All
StringReplace, bbcode, bbcode, ], >, All
ifinstring, bbcode, <li>
FileAppend,%bbcode%
else
ifinstring, bbcode, </li>
FileAppend,%bbcode%
else
ifinstring, bbcode, <ul>
FileAppend,%bbcode%
else
ifinstring, bbcode, </ul>
FileAppend,%bbcode%
else
FileAppend,%bbcode%<br>
}
run, iexplore.exe %a_workingdir%\html.htm
Exitapp