Mike - K8LH
Well-Known Member
I use tabs in my source files but the forum software doesn't like them in the code you place between <code> tags in a post. Instead of manually typing in spaces to maintain a 'clean' format for posted code I decided to finally write a little program to do it for me using the 'free' JustBASIC compiler.
The program doesn't alter your source file. It simply prints each source line to the console after replacing tabs with spaces. Select and copy the cleaned up code from the console then paste it via the clipboard between code tags in your forum post.
Enjoy, Mike
The program doesn't alter your source file. It simply prints each source line to the console after replacing tabs with spaces. Select and copy the cleaned up code from the console then paste it via the clipboard between code tags in your forum post.
Enjoy, Mike
Code:
'
' Forum Code-Tag-Fix v1.1 by Mike McLaren, K8LH
'
' replaces <tab> characters with spaces (tabs = 8).
' does not alter your source file.
'
' Instructions
'
' 1 - select your source file from the File Dialog
' 2 - select output text displayed in console window
' 3 - copy to clipboard using <ctrl-C> or <edit> <copy>
' 4 - paste between code tags in your Forum post
'
' JustBASIC v1.01
'
filedialog "Source File?", "*.asm", fileName$
if fileName$ <> "" then
open fileName$ for input as #f
while eof(#f) > -1
line input #f, aLine$ : hpos=1
for x = 1 to len(aLine$)
if (mid$(aLine$,x,1)<>chr$(9)) then
print mid$(aLine$,x,1); : hpos=hpos+1
else
while hpos MOD 8 <> 0
print " "; : hpos=hpos+1
wend
print " "; : hpos=hpos+1
end if
next x
print
wend
close #f
end if
end