Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The look of forum code
#2
This isn't perfect, but it's an idea!
Function Copy_BBCode
Trigger CSc /QM     Help - how to add the trigger to the macro
Code:
Copy      Help
men 33353 id(2213 win("" "QM_Editor")) ;;Copy BBCode
str s.getclip()
s.findreplace(";" "[color=#FFFFFF]|[color=#008000]")
s.findreplace("[color=#e0e0e0],,," "[color=#FFFFFF]||||||||||||")
s.findreplace("[color=#e0e0e0],," "[color=#FFFFFF]||||||||")
s.findreplace("[color=#e0e0e0]," "[color=#FFFFFF]||||")
s.from("[code]" s (`s)"
"(`)(`p))(`)
(`c);out s(`)
s.setclip(`p)()(`)
[/code]

I don't see why doing this on every paste would really be much of a problem...unless "|" was trying to be copied and pasted. Anyways...just an idea.

I know that Gintaras can make this run a lot smoother, he has mastered the "Copy BBCode" I could do neater things if I knew what was all involved with that...then also he has "copy for QM forum"...which looks even more complex. So like I said, only an idea...


Here is an example of code I copied using the above script:
Code:
Copy      Help
out
int i=2
sel i
||||case [1,3,5,7,9]
||||out("%i is Odd" i)
||||case [2,4,6,8]
||||out("%i is Even" i)
||||case [0]
||||out "The number is Zero"
sel i
||||case [0,2,1,3,5,7,9]
||||if i<9
||||||||out "Don't for get that's a prime number too!"

Here is the code for pasting back into QM:
Function Paste_BBCode
Trigger CSv /QM     Help - how to add the trigger to the macro
Code:
Copy      Help
str s.getclip()
out "-------------------"
out "Original text"
out "-------------------"
out s
s.findreplace("||||" "[9]")
_s.get(s 0 1)
if _s="|"
,s.findreplace("|" " " 4)
outp s


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)