AutoHotkey Community

It is currently May 27th, 2012, 8:00 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Convert BBCode to HTML
PostPosted: April 23rd, 2005, 12:01 am 
Offline

Joined: April 28th, 2004, 1:12 pm
Posts: 349
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.zip

Code:
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%, &nbsp`;&nbsp`;&nbsp`;, All


ifinstring,bbcode ,%a_space%%a_space%%a_space%
StringReplace, bbcode, bbcode, %a_space%%a_space%%a_space%, &nbsp`;&nbsp`;&nbsp`;, All
else
ifinstring,bbcode ,%a_space%%a_space%
StringReplace, bbcode, bbcode, %a_space%%a_space%, &nbsp`;&nbsp`;, 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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 26th, 2005, 5:57 pm 
Nice work, does anyone know how to convert HTML code into BB code?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 5th, 2005, 3:19 pm 
Offline

Joined: April 28th, 2004, 1:12 pm
Posts: 349
djc123 wrote:
Nice work, does anyone know how to convert HTML code into BB code?



Code:


Menu, Tray, NoStandard
Menu, Tray, Add, Hide,ShowHide
Menu, Tray, default,Hide
Menu, Tray, Add, Exit

Gui, Add, Edit, x6 y30 w450 h340 vCode,

Gui, Add, Text, x6 y10 w450 h20, Enter HTML below. Only the HTML tags which have BBCode equivelents will be converted.
Gui, Add, Button, x356 y380 w100 h30 gSubmit, Convert to BBCode

Gui, Add, Radio, x6 y390 w60 h20 gIPBorPHPBB vPHPBBchecked, PHPBB
Gui, Add, Radio, x76 y390 w40 h20 Checked1 gIPBorPHPBB, IPB
Gui, Add, Text, x6 y370 w230 h20, What type of forum will you be posting to?

Gui, Show, h417 w463, HTML to BBCode Converter
k_IsVisible = y
board=IPB
Return

GuiClose:
ExitApp

IPBorPHPBB:
Gui, Submit, Nohide

if PHPBBchecked=1
board=PHPBB
else
board=IPB

return

ShowHide:
if k_IsVisible = y
{
   Gui, Cancel
   Menu, Tray, Rename, Hide, Show
   k_IsVisible = n
}
else
{
   Gui, Show
   Menu, Tray, Rename, Show, Hide
   k_IsVisible = y
}
return



Submit:
Gui, Submit, Nohide

string=%Code%

;-------------------------------------------------------------Other font options

if board=IPB
{
StringReplace, string, string, <strike>, [s], All
StringReplace, string, string, </strike>, [/s], All
}
else
{
StringReplace, string, string, <strike>,, All
StringReplace, string, string, </strike>,, All
}

StringReplace, string, string, <b>, [b], All
StringReplace, string, string, </b>, [/b], All

StringReplace, string, string, <strong>, [b], All
StringReplace, string, string, </strong>, [/b], All

StringReplace, string, string, <i>, [i], All
StringReplace, string, string, </i>, [/i], All

StringReplace, string, string, <u>, [u], All
StringReplace, string, string, </u>, [/u], All

StringReplace, string, string, <i>, [i], All
StringReplace, string, string, </i>, [/i], All

StringReplace, string, string, <em>, [i], All
StringReplace, string, string, </em>, [/i], All

StringReplace, string, string, <br>,`n, All

;-------------------------------------------------------------------blockquote



StringReplace, string, string, <blockquote>, [quote], All

ifinstring, string, <BLOCKQUOTE
{

url=%string%

StringSplit, url_array, url, <

Loop, %url_array0%
{
StringTrimLeft, this_url, url_array%a_index%, 0

this_url=<%this_url%

ifinstring, this_url, <BLOCKQUOTE%a_space%
{

stringreplace, string, string, %this_url%, [quote]

}
}
}
StringReplace, string, string, </blockquote>, [/quote], All


;-----------------------------------------------------------------------------------------------------------


if board=IPB
{
StringReplace, string, string, <center>, [center], All
StringReplace, string, string, </center>, [/center], All
}
else
{
StringReplace, string, string, <center>, , All
StringReplace, string, string, </center>, , All
}

;--------------------------------------------------------------------Changes URL's

ifinstring, string, href=
{

url=%string%

StringSplit, url_array, url, <

Loop, %url_array0%
{
StringTrimLeft, this_url, url_array%a_index%, 0

ifinstring, this_url, href=
{
url=%this_url%
oldurl=<%url%

;gets url name

StringLen, url_length, url
StringGetPos, namepos, url, >, R1
urlname:=url_length-namepos
urlname-=1
StringRight, urlname, url, %urlname%

;gets url

StringReplace, url, url,", , All
StringReplace, url, url, a href=, , All

autotrim, off
StringGetPos, urlpos, url, %a_space%, L1
autotrim, on

if urlpos=-1
StringGetPos, urlpos, url, >, L1

StringLeft, out_url, url, %urlpos%

stringreplace, out_url, out_url, ",,all

newurl=[url="%out_url%"]%urlname%

stringreplace, newurl, newurl, ",,all

   stringgetpos, pos1,newurl, >
if pos1!=-1
{
   stringgetpos, pos2,newurl, ]
if pos2 != -1
{
   pos1+=1
   pos2+=1
   stringmid, replace, newurl, %pos1%, % pos2-pos1
   stringreplace, newurl, newurl, %replace%,
}
}

stringreplace, string, string, %oldurl%, %newurl%

stringreplace, string, string, </a>,[/url], all

}
}
}

;---------------------------------------------------------------Converts images

ifinstring, string, <img
{

;StringReplace, string, string, src=, <[img], all

StringReplace, string, string, src=, [img], all
;StringReplace, string, string, <img, , all


url=%string%

StringSplit, url_array, url, <

Loop, %url_array0%
{
StringTrimLeft, this_url, url_array%a_index%, 0

ifinstring, this_url, [img]
{
url=<%this_url%

   stringgetpos, pos1,url, <
if pos1!=-1
{
   stringgetpos, pos2,url, [
if pos2 != -1
{
   pos1+=1
   pos2+=1
   stringmid, replace, url, %pos1%, % pos2-pos1
   stringreplace, url, url, %replace%,
}
}

;get old url

;StringGetPos, namepos, url, >, L1
;StringLeft, oldurl, url, %namepos%

oldurl=%replace%%url%


;gets url name

autotrim, off
StringGetPos, namepos, url,%a_space%, L1
autotrim, on

if namepos=-1
StringGetPos, namepos, url, >, L1

StringLeft, urlname, url, %namepos%

newurl=%urlname%[/img]

StringReplace, newurl, newurl,", , All

stringreplace, string, string, %oldurl%, %newurl%

}
}
}

;-----------------------------------------------------------------Font

ifinstring, string, <FONT
{

url=%string%

StringSplit, url_array, url, <

Loop, %url_array0%
{
StringTrimLeft, this_url, url_array%a_index%, 0

;autotrim, off

ifinstring, this_url, Font%a_space%
{

;autotrim, on

oldurl=%this_url%

StringReplace, this_url, this_url, color=, [color=, all
StringReplace, this_url, this_url, size=, [size=, all
StringReplace, this_url, this_url, face=, [font=, all

;----------------------------------------------------------------------------------color

ifinstring, this_url, [color=
{
StringGetPos, colorpos, this_url, [color=
StringGetPos, colorpos2, this_url,%a_space%, L, %colorpos%

if colorpos2=-1
StringGetPos, colorpos2, this_url,>, L, %colorpos%

colorpos2+=1
StringMid, colorBBCode, this_url, %colorpos%, % colorpos2-colorpos

ifinstring, colorBBCode,>
{
stringgetpos, GTPos, colorBBCode, >
StringLeft, colorBBCode, colorBBCode, %GTPos%
}

stringreplace, this_url, this_url, %colorBBCode%, %colorBBCode%]

this_url=%this_url%
}


;----------------------------------------------------------------------------------size

ifinstring, this_url, [size=
{
StringGetPos, sizepos, this_url, [size=
StringGetPos, sizepos2, this_url,%a_space%, L, %sizepos%

if sizepos2=-1
StringGetPos, sizepos2, this_url,>, L, %sizepos%

sizepos2+=1
StringMid, sizeBBCode, this_url, %sizepos%, % sizepos2-sizepos

ifinstring, sizeBBCode,>
{
stringgetpos, GTPos, sizeBBCode, >
StringLeft, sizeBBCode, sizeBBCode, %GTPos%
}

stringreplace, sizeBBCode, sizeBBCode, ",,all

StringRight, FontSize, sizeBBCode, 2

IfInString, FontSize, =
{
StringRight, FontSize, sizeBBCode, 1
StringTrimRight, sizeBBCode, sizeBBCode, 1
}
else
{
StringRight, FontSize, sizeBBCode, 2
StringTrimRight, sizeBBCode, sizeBBCode, 2
}

if board=IPB
{
if FontSize <=1
this_size = 1

if FontSize = 2
this_size = 3

if FontSize = 3
this_size = 5

if FontSize = 4
this_size = 7

if FontSize = 5
this_size =11

if FontSize = 6
this_size = 17

if FontSize >= 7
this_size = 23
}

if board=PHPBB
{
if FontSize <=1
this_size = 11

if FontSize = 2
this_size = 13

if FontSize = 3
this_size = 19

if FontSize = 4
this_size = 24

if FontSize = 5
this_size =24

if FontSize = 6
this_size = 29

if FontSize >= 7
this_size = 29
}

stringreplace, this_url, this_url, %FontSize%,

stringreplace, this_url, this_url, %sizeBBCode%, %sizeBBCode%%this_size%]

this_url=%this_url%[/size]
}





;---------------------------------------------------------------------------------font

ifinstring, this_url, [font=
{
StringGetPos, fontpos, this_url, [font=


StringGetPos, fontpos2, this_url,[, L2, %fontpos%


if fontpos2=-1
StringGetPos, fontpos2, this_url,>, L, %fontpos%

fontpos2+=1
StringMid, fontBBCode, this_url, %fontpos%, % fontpos2-fontpos

ifinstring, fontBBCode,>
{
stringgetpos, GTPos, fontBBCode, >
StringLeft, fontBBCode, fontBBCode, %GTPos%
}

if board=PHPBB
{
stringreplace, this_url, this_url, %fontBBCode%,
}
else
{
stringreplace, this_url, this_url, %fontBBCode%, %fontBBCode%]
this_url=%this_url%[/font]
}

}

;---------------------------------------------------------------------------------style

ifinstring, this_url, style=
{
StringGetPos, stylepos, this_url, style=
StringGetPos, stylepos2, this_url,%a_space%, L, %stylepos%

if stylepos2=-1
StringGetPos, stylepos2, this_url,>, L, %stylepos%

stylepos2+=1
StringMid, styleBBCode, this_url, %stylepos%, % stylepos2-stylepos

ifinstring, styleBBCode,>
{
stringgetpos, GTPos, styleBBCode, >
StringLeft, styleBBCode, styleBBCode, %GTPos%
}

stringreplace, this_url, this_url, %styleBBCode%,
}

;---------------------------------------------------------------------------------

StringReplace, this_url, this_url, >, ,All

newurl=%this_url%
StringReplace, newurl, newurl,", , All
stringreplace, string, string, %oldurl%, %newurl%

}
}
}
autotrim, off
stringreplace, string, string, <Font%a_space%, ,all
stringreplace, string, string, </Font>, ,all
autotrim, on

;------------------------------------------------------------------End Font






StringReplace, string, string,< <[img], [img], All

;-----------------------------------------------------------------Adds new lines

stringreplace, string, string,<br>, `n ,All
stringreplace, string, string,<p>, `n ,All
stringreplace, string, string,</p>, `n ,All



;-------------------------------------------------------------Lists


StringReplace, string, string, <ul>, [list], All
StringReplace, string, string, <ol>, [list=1], All
StringReplace, string, string, <ol type="I">, [list=i], All
StringReplace, string, string, <ol type="a">, [list=a], All

StringReplace, string, string, </ul>, [/list], All
StringReplace, string, string, </ol>, [/list], All

ifinstring, string, <li>
{
StringReplace, string, string, <li>, [*], All
}

StringReplace, string, string, </li>, , All

StringReplace, string, string, </a>, [/url], All

StringReplace, string, string, <a href=, [url=, All

StringReplace, string, string, <hr>, ----------------------------------------, all


;-------------------------------------------------------------Code and Quotes with tables

StringReplace, string, string, <table bgcolor="#FAFCFE" align="center" width="95`%" border="1"><tr bgcolor="#FDDBCC"><td><b>Code:</b></td></tr><tr><td><font color="#008000">, [code], All
StringReplace, string, string, </font></td></tr></table>, [/code], All

StringReplace, string, string, <table bgcolor="#FAFCFE" align="center" width="95`%" border="1"><tr bgcolor="#E8EFF7"><td><b>Quote:</b></td></tr><tr><td>, [quote], All
StringReplace, string, string, </td></tr></table>, [/quote], All


;------------------------------------------------------------------

;--------------------------------------------------------------------p

StringReplace, string, string, <p>, , All

ifinstring, string, <p
{

url=%string%

StringSplit, url_array, url, <

Loop, %url_array0%
{
StringTrimLeft, this_url, url_array%a_index%, 0

this_url=<%this_url%

ifinstring, this_url, <p%a_space%
{
ifinstring, this_url, align=
{
oldurl=%this_url%

url=%this_url%

stringreplace, url, url, ",,all

ifinstring, url, align=center
{

if board=IPB
{
stringreplace, url, url, align=center, [center], All
url=%url%[/center]
}
else
{
stringreplace, url, url, align=center,, All
url=%url%
}

}

ifinstring, url, align=left
{
if board=IPB
{
stringreplace, url, url, align=left, [left], All
url=%url%[/left]
}
else
{
stringreplace, url, url, align=left,, All
url=%url%
}
}


ifinstring, url, align=right
{
if board=IPB
{
stringreplace, url, url, align=right, [right], All
url=%url%[/right]
}
else
{
stringreplace, url, url, align=right,, All
url=%url%
}
}

stringgetpos, pos, url, [
stringtrimleft, url, url, %pos%

stringgetpos, pos1,url, ]
stringgetpos, pos2,url, >
pos1+=2
pos2+=2
stringmid, replace, url, %pos1%, % pos2-pos1
stringreplace, url, url, %replace%

stringreplace, string, string, %oldurl%, %url%

}
}

}
}
StringReplace, string, string, </p>, `n, All



;--------------------------------------------------------------------div


StringReplace, string, string, <div>, , All

ifinstring, string, <div
{

url=%string%

StringSplit, url_array, url, <

Loop, %url_array0%
{
StringTrimLeft, this_url, url_array%a_index%, 0

this_url=<%this_url%

ifinstring, this_url, <div%a_space%
{
ifinstring, this_url, align=
{
oldurl=%this_url%

url=%this_url%

stringreplace, url, url, ",,all

ifinstring, url, align=center
{

if board=IPB
{
stringreplace, url, url, align=center, [center], All
url=%url%[/center]
}
else
{
stringreplace, url, url, align=center,, All
url=%url%
}

}

ifinstring, url, align=left
{
if board=IPB
{
stringreplace, url, url, align=left, [left], All
url=%url%[/left]
}
else
{
stringreplace, url, url, align=left,, All
url=%url%
}
}


ifinstring, url, align=right
{
if board=IPB
{
stringreplace, url, url, align=right, [right], All
url=%url%[/right]
}
else
{
stringreplace, url, url, align=right,, All
url=%url%
}
}

stringgetpos, pos, url, [
stringtrimleft, url, url, %pos%

stringgetpos, pos1,url, ]
stringgetpos, pos2,url, >
pos1+=2
pos2+=2
stringmid, replace, url, %pos1%, % pos2-pos1
stringreplace, url, url, %replace%

stringreplace, string, string, %oldurl%, %url%

}
}

}
}
StringReplace, string, string, </div>, , All

;----------------------------------------------------------------------------------------

StringReplace, string, string, <code>, [code], All
StringReplace, string, string, </code>, [/code], All

autotrim, off
stringreplace, string, string,&nbsp`;, %a_space% ,All
StringReplace, string, string,&quot`;,, All
autotrim, on



Code=%string%

filedelete, code.txt
fileappend, %Code%, code.txt


filedelete, outputText.txt

;removes all other html tags

Loop, read, code.txt, outputText1.txt
{
string=%A_LoopReadLine%

loop
{

ifinstring,string, <head>
head=1

ifinstring, string, </head>
head=2

ifinstring,string, <script
script=1

ifinstring,string, </script>
script=2

if head=1
{
StringReplace, string, string, %string%,, All
break
}

if script=1
{
StringReplace, string, string, %string%,, All
break
}

StringGetPos, stringpos1, string, <, L1
StringGetPos, stringpos2, string, >, L1

if stringpos1 = -1
break

if stringpos2 = -1
break

stringpos1+=1
stringpos2+=2


removelength:=stringpos2-stringpos1

if removelength <= 0
break

StringMid, texttoremove, string, %stringpos1%, %removelength%

StringReplace, string, string, %texttoremove%,, All

}

StringReplace, string, string, &amp`;,&, All
StringReplace, string, string, &gt`;,>, All
StringReplace, string, string, &lt`;,<, All

autotrim, off
if string <>
{
if addspaces=0
{
FileAppend, %string%%a_space%
}
else
{
FileAppend, %string%`r`n
}
}
autotrim, on
}

autotrim, on
Loop, read, outputText1.txt, outputText.txt
{
string=%A_LoopReadLine%
FileAppend, %string%`n
}
filedelete, outputText1.txt



run, notepad.exe outputText.txt

return

Exit:
Exitapp



edit:

Any left over HTML tags that do not have BBCode equivelents are now removed.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: html --> bbcode
PostPosted: March 23rd, 2006, 6:45 am 
just wondering, how do i convert the following html to bbcode? thanks.

Code:
<br><embed src='http://blingselect.com/add/shock1.swf' quality=high FlashVars='texter=Your Text Here' bgcolor='000000' wmode=transparent width='375' height='80' align=middle ></embed><br>


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2006, 10:36 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
That's easy: you cannot!
BBCode has a very limited set of commands, partly to simplify the life of users, partly for security reasons. And commands like <embed>, allowing to run arbitrary native code (more or less) are very insecure!

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
PostPosted: July 23rd, 2006, 3:37 pm 
can someone please convert this for me i would be very thankful if not can they point me somewere i can get it dont thanks


<p align="center"><center><font face="Impact"
color="red"><font size=7">Whatever you do, DON'T CLICK ON THIS!!!</font></font></center></p>


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 23rd, 2006, 4:20 pm 
Quote:
can someone please convert this for me

Code:
String = <p align="center"><center><font face="Impact"
color="red"><font size=7">Whatever you do, DON'T CLICK ON THIS!!!</font></font></center></p>
StringReplace, ConvertedString, String, <p align="center"><center><font face="Impact"
color="red"><font size=7">Whatever you do, DON'T CLICK ON THIS!!!</font></font></center></p>, Lalala!
MsgBox % ConvertedString
Done!


Report this post
Top
  
Reply with quote  
 Post subject: thanks
PostPosted: July 23rd, 2006, 5:25 pm 
thank you very much :D :D :D


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 24th, 2006, 8:21 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
align=center and <center> are bit redundant, here. And the double <font> tag smells like machine generated... Note also that there is nothing to click on in the fragment you provided.

Dumbledore, I fear you thanked BoBo before trying what he gave...

You cannot convert this HTML directly to BBCode: there is no font selection, nor aligment tag (perhaps some versions accepts [center][/center] but not this one). So the best you can do is: [size=9][color=red]Lalala![/color][/size]

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
PostPosted: December 15th, 2006, 5:38 am 
Jon wrote:
djc123 wrote:
Nice work, does anyone know how to convert HTML code into BB code?


edit:

Any left over HTML tags that do not have BBCode equivelents are now removed.


Jon . . .

First at All . . . Thank You Very Much for that code from BBC2HTML

YAHVeH - YHVH GOD Bless You. . . and Your Family . . .

You don't have any idea how much I was looking for it . . . And Took me
1 Year to Find You. . . But . . . The Controversy is that I have been using HiJackThis for more than 2 years . . . I don't Know . . . how that Happen but . . . Finally . . . BBC to HTML . . .

I am an ex-Suicidal personality for 14 summers, that in recovery found a Help in Christianity and a YAHshua Jesus has never Before. . . so I have been in the Internet since 1995 but as a Christian Document Distribuitor since 1999 so . . . I am back and for from BBC to HTML and visceversa. . . is . . . Tedious Job. . . but Edificant, and Selft Re-warding, I enjoy it, and what ever Preach or Sermon is in English I translated to Spanish, and Whatever is in Spanish to English Speakers readers in different Forums. . .

Now with your Utility. . . is . . . going to speed up my job. . . but . . .

Can You Please . . . make those codes HTML 2 BBCode in a Program . . . because I can see the Codes. . . but I don not how to Compile that . . . anyway I don't know in what Programming Language is . . . so will be better for me . . . if you can provide me with an EXEcutable File as Tool. . . So I can really Jump from Forums to Bloggers. . . Please. . .

I have seen a nice TEXT Editor thata I want, because convert On the Fly with a single Copy and Paste, what ever you are bringing in Your ClipBoard RAM memory . . . to BBCode is a kind of Code Changer in this Foro . . .

http://www.MioTraGus.org

http://foro.miotragus.org/index.php

( Oh by the way it is in Spanish - Plus is closed Temporarily because they are Renovating and they will need 3 weeks to Enhance that Software IT Forum )

I have been using that . . . but I do not want to Login in that Forum all the Time that I want to change a Layout. . . can you do for me this other Favor. . . I need to have a Tool like that Tag Generator, Changer or whatever you Smart Guys called that TEXT EDITORS . . . with all the Table of Safe Colors Pallette. . .

Atte.:

Sincerely . . . and Warmly in the Name of YAHshua Jesus . . .

Buscando La Verdad

Searching The Truth . . .

http://journals.aol.com/buscandodeverdad/

http://www.honduras.com/catracho-forum/viewtopic.php?t=10949


Image

CWA @ Mail.com

14 December 2006


Report this post
Top
  
Reply with quote  
PostPosted: December 15th, 2006, 8:11 am 
I got so Excited that I try to compile it in a EXE Program


So . . . I download AutoHotkey.exe

From http://www.autohotkey.com/forum/topic4398.html

Titan wrote:
AutoHotkey.net is back with a new file manager.

You can create an account for your own upload space to share your scripts online.


the C:\Program Files\AutoHotkey\AutoHotkey.exe

The Same Group of Tools. . . came this one. . . The Compiler

AutoHotkey\Compiler\Ahk2Exe.exe

So animated I did Copy and Paste in a New NotePad file with the extention ahk so . . . I just add the name of ; The Creator - Jon and the URL's WebSite where I found this Codes, that means this Forum. . .

So I did this additions. . . to the Jon Programming

;HTML2BBCode.ahk
; Convert HTML 2 BBC codes WebSites Code to Forum Codes
;Jon @ Tue Jul 2005, 2005 2:19 pm http://www.autohotkey.com/forum/topic3297.html

Menu, Tray, NoStandard
Menu, Tray, Add, Hide,ShowHide
Menu, Tray, default,Hide
Menu, Tray, Add, Exit

Then . . . I remove the *.txt in the name of HTML2BBCode.ahk.txt
so I ended up with something like this. . .

HTMLtoBBCode.ahk

Then I Converted to EXEcutable with The Compiler

AutoHotkey\Compiler\Ahk2Exe.exe

Now I will . . . Run a Test. . . ALL in less than 2 minutes. . .

Thank You Once Agan. . . and Forever. . .

Buscando La Verdad . . .

Searching The Truth . . .


Report this post
Top
  
Reply with quote  
PostPosted: December 15th, 2006, 8:26 am 
Buscando La Verdad wrote:

YAHVeH - YHVH GOD Bless You. . . All of You Creators and Smar People, and Programmers . . .

Jon . . .

First at All . . . Thank You Very Much for that code from BBC2HTML

The First Convertion EXEcutable Program from BBC2HTML

Code:

<table bgcolor="#FAFCFE" align="center" width="95%" border="1"><tr bgcolor="#E8EFF7"><td><b>Quote: </b>"Buscando La Verdad"</td></tr><tr><td>I got so Excited that I just click and <font color=red>download</font> AutoHotkey.exe<br><br>From  <a href="http://www.autohotkey.com/forum/topic4398.html">http://www.autohotkey.com/forum/topic4398.html</a><br><br><table bgcolor="#FAFCFE" align="center" width="95%" border="1"><tr bgcolor="#E8EFF7"><td><b>Quote: </b>"Titan"</td></tr><tr><td><a href=http://www.autohotkey.net>AutoHotkey.net</a><font color=olive> is back with</font> a <font color=green>new file manager</font>.<br><br><font color=olive>You can create an account for your own upload space to share your scripts online</font>.</td></tr><br><br></table>



. . . The Same Table . . . or Paragraph . . .

Now The Second Convertion with my ricently compiled EXEcutable Program from HTML2BBC

Code:

[b]Quote: [/b]"Buscando La Verdad"I got so Excited that I just click and download AutoHotkey.exe
From  [url=http://www.autohotkey.com/forum/topic4398.html]http://www.autohotkey.com/forum/topic4398.html[/url]
[b]Quote: [/b]"Titan"[url=http://www.autohotkey.net]AutoHotkey.net[/url] is back with a new file manager.
You can create an account for your own upload space to share your scripts online.



Voila !! I am a Happy Man . . .
Now I can make more People Happy . . . providing more Preaches and Sermons. . .

From Forum to Bloggers . . .


Buscando La Verdad

Searching The Truth . . .

http://journals.aol.com/buscandodeverdad/

http://www.honduras.com/catracho-forum/viewtopic.php?t=10949


Image

CWA @ Mail.com

14 December 2006



Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 15th, 2006, 11:26 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
A happy user!...
Good job, you ask questions, but don't hesitate to try out and share your findings.
That's funny, a Christian person using Crumb's drawing as a signature... :-)
PS.: if you have time, take a look at the manual, I am sure AHK can provide great help for a lot of your tedious works.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
PostPosted: December 30th, 2006, 6:51 pm 
Jon wrote:
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.zip



Hi Jon,
I am an old generation programmer (vb 6 and ASP, no .net for me...)
Still i am looking for a way to convert bbcode in my PHPBB forum to HTML.
I understood most of your code but i wonder if you have something ready that i can use on a ASP page.

I am looking for a function that i can send her a bbcode text (the post from the forum) and get HTML back

Thanks*100000

Dori


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 30th, 2006, 8:28 pm 
Quote:
I am looking for a function that i can send her a bbcode text (the post from the forum) and get HTML back
Don't know if it's of help, but maybe you can take my CreatePreview subroutine from my BBCodeWriter Script and make a function out of it. :)
________________________
Cheers
AGU


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Cristi® and 11 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group