AutoHotkey Community

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 25 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: December 31st, 2006, 10:22 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
dori wrote:
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
So you need some VB code instead.
Real BBCode to HTML is slightly more complex than what is shown above.
I compiled a list of rules to make a more thorough converter (to be done), I can put them here, you will then have to write the corresponding code in VB, which shouldn't be so hard.
Does the VB used in ASP (not ASP.NET, I suppose) have access to regular expressions?

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: VB Script
PostPosted: December 31st, 2006, 5:19 pm 
Hi all and thank you....

I think regular expressions is a subset of VB Script 5 or higher.
So i have access to it.
I read a bit about it but i need to read it more in order to start using it.....

here is an short article abou it
http://authors.aspalliance.com/brettb/S ... ssions.asp

:?


Report this post
Top
  
Reply with quote  
 Post subject: CreatePreview
PostPosted: December 31st, 2006, 6:00 pm 
AGU wrote:
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


Hi Agu
thanks a lot.

Is this C++ ???
i am not sure i can run this whitin an ASP page


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 1st, 2007, 1:33 am 
Quote:
Is this C++ ???
i am not sure i can run this whitin an ASP page

Sorry it's no C++, it's AHK syntax. As you were asking within this forum I assumed you were looking for an AHK solution.

After reading your first posting I'm asking myself why you were posting your request in this place instead of an ASP or VB forum. Don't you think this might yield better solutions than asking here in AHK forum?
_______________________
Cheers
AGU


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2009, 6:15 am 
I've been trying to convert this video gam embedding code to BBcode and I just can't get it right. Help?

<div align="center"><a href="http://www.freehobo.com/games/super-mario-bros-flash">Play Super Mario Bros. Flash</a><br /><a href="http://www.freehobo.com/games/super-mario-bros-flash"><img src="http://www.freehobo.com/m_games/thumbs/super-mario-remake.gif" border="1" width="100" height="100"></a><br />More <a href="http://www.freehobo.com" style="font-weight:bold">free games</a> at freehobo.com</div>


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2009, 7:36 am 
Offline

Joined: May 28th, 2008, 2:11 am
Posts: 739
Location: Minnesota, USA
Well, the <div align="center"></div> can't be converted, and neither can the border/width/height of the image, but the rest should simply be this...
Code:
[url=http://www.freehobo.com/games/super-mario-bros-flash]Play Super Mario Bros. Flash[/url]
[url=http://www.freehobo.com/games/super-mario-bros-flash][img]http://www.freehobo.com/m_games/thumbs/super-mario-remake.gif[/img][/url]
More [url=http://www.freehobo.com][b]free games[/b][/url] at freehobo.com

_________________
Unless otherwise stated, all code is untested

(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: July 4th, 2011, 6:49 pm 
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.

I would really appreciate the help.

Thanks!



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

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
  
Reply with quote  
 Post subject:
PostPosted: July 4th, 2011, 6:57 pm 
Offline
User avatar

Joined: May 18th, 2010, 3:10 pm
Posts: 1179
Location: Sweden
CMJavaGirl, if you are the owner of your board, it would probably be easier to do the scripting serverside.

_________________
~sumon Appifyer AHK Nova halted Recommended: AHK_L (Why?)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 4th, 2011, 8:33 pm 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Just in case you still need this add this to the script before the fileappend command anyway
Code:
ifinstring, bbcode, [center]
   {
      stringreplace, bbcode, bbcode, [center], <center>, all
      stringreplace, bbcode, bbcode, [/center], </center>, all
   }

_________________
AHK FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
PostPosted: November 25th, 2011, 4:24 am 
Offline

Joined: November 25th, 2011, 4:20 am
Posts: 1
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

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


ola, gostaria de saber se existe algum codigo para fazer com que meu site reconheça bbcode ??
e o que ezatamente faz esse codigo acima ?


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Yahoo [Bot] 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