Petr Schreiber
25-08-2009, 21:21
PSPad is general purpose "programmers" text editor, which can be used for editing and running ThinBASIC scripts as well. The following text will guide you step by step to make PSPad your IDE for ThinBASIC.
Step #1: Download and install PSPad
PSPad comes in various language versions, I recommend the English one.
You can download it from here:
PSPad Download [ENGLISH] (http://www.pspad.com/en/download.php)
It is possible that after installation, PSPad will autodetect your language and "localize" itself automagically.
Step #2: Adding syntax definition
Use following script to generate INI file for you, move that INI to:
\PSPad editor\Syntax\ThinBASIC.ini
' -- Script to generate ThinBASIC.ini for PSPad
uses "ADO","Biff","Bundle","CGI","COM","COMM","Console","Crypto","Dictionary","DT","Eval","Exe","FBGFX","File","FileLine","FTP","GDIp","Inet","INI","LAN","LL","Math","OnlineScores","OS","Oxygen","PC","RAS","Registry","SAPI","SMTP","STAT","TBASS","TBDI","TBEM","TBGL","TcpUdp","Tokenizer","UI","UIAdv","VBRegExp","WMI","XPRINT","ZLIB"
dim iniOut as string = ";PSPad user HighLighter definition file"+ $CRLF + _
"[Settings]"+ $CRLF + _
"Name=THINBASIC"+ $CRLF + _
"HTMLGroup=0"+ $CRLF + _
"Label=0"+ $CRLF + _
"FileType=*.tbasic"+ $CRLF + _
"CommentString="+ $CRLF + _
"REMComment=1"+ $CRLF + _
"SinglQComment=1"+ $CRLF + _
"Preprocessors=1"+ $CRLF + _
"IndentChar="+ $CRLF + _
"UnIndentChar="+ $CRLF + _
"TabWidth=0"+ $CRLF + _
"DoubleQuote=1"+ $CRLF + _
"KeyWordChars=_$%"+ $CRLF + _
"CodeExplorer=ftVBS"+ $CRLF + _
"[KeyWords]"+ $CRLF + _
DIM sKeys AS STRING
DIM aKeys() AS STRING
DIM nKeys AS LONG
DIM Count AS LONG
'---Get a string with keywords separated by $TAB
sKeys = APP_ListKeywords
'---Parse string into an array
PARSE sKeys, aKeys, $TAB
'---Creates output buffer
nKeys = UBOUND(aKeys(1))
FOR Count = 1 TO nKeys
IF aKeys(Count) <> "REM" THEN
iniOut += aKeys(Count)+"=" + $CRLF
END IF
NEXT
iniOut += "[ReservedWords]"
'---Get a string with keywords separated by $TAB
sKeys = APP_ListEquates
'---Parse string into an array
PARSE sKeys, aKeys, $TAB
'---Creates output buffer
nKeys = UBOUND(aKeys(1))
FOR Count = 1 TO nKeys
iniOut += aKeys(Count)+"=" + $CRLF
NEXT
iniOut += "[KeyWords2]"+$CRLF+"[KeyWords3]"
file_save("ThinBasic.ini", iniOut)
Optional: Start PSPad, go to Settings/User higlighter and select this file.
Dialog will appear, just hit "SAVE" button.
Step #3: Adding filter
You will find Documents/<userName>/Application Data/PSPad/PSPad.ini and append the following to it (change things in bold to match your setup):
[THINBASIC]
Filter=THINBASIC (*.tbasic)|*.tbasic
HLTabWidth=2
IndentChar=
UnIndentChar=
Comment=000080001FFFFFFF010
Identifier=1FFFFFFF1FFFFFFF000
Key=008040001FFFFFFF100
Key words 2=004080FF1FFFFFFF100
Key words 3=1FFFFFFF1FFFFFFF100
Label=000000FF1FFFFFFF000
Number=008000001FFFFFFF000
Preprocessor=008080001FFFFFFF010
Reserved Word=004000801FFFFFFF100
Space=008080001FFFFFFF000
String=000000FF1FFFFFFF000
Symbol=1FFFFFFF1FFFFFFF000
Compilator File=E:\util\thinBasic\thinBasic.exe
Compilator Param=%File%
Compilator LOG=
Compilator Run=E:\util\thinBasic\thinBasic.exe
Compilator Help=E:\util\thinBasic\Help\thinBasic.chm
Compilator SaveAll=0
Compilator ParsLog=
Compilator Capture=1
Compilator HideOutput=0
Compilator DefaultDir=
Compilator LogType=0
Also do not forget to set value of UserHighLighterName (5th row of ini file)
UserHighLighterName=ThinBasic
Now you are finished. Just open tBasic files, and they will be highlighted correctly.
Ctrl+Shift+E brings you to code explorer, which allows you to navigate through Functions and Subs.
To run scripts, use Ctrl+F9.
Step #1: Download and install PSPad
PSPad comes in various language versions, I recommend the English one.
You can download it from here:
PSPad Download [ENGLISH] (http://www.pspad.com/en/download.php)
It is possible that after installation, PSPad will autodetect your language and "localize" itself automagically.
Step #2: Adding syntax definition
Use following script to generate INI file for you, move that INI to:
\PSPad editor\Syntax\ThinBASIC.ini
' -- Script to generate ThinBASIC.ini for PSPad
uses "ADO","Biff","Bundle","CGI","COM","COMM","Console","Crypto","Dictionary","DT","Eval","Exe","FBGFX","File","FileLine","FTP","GDIp","Inet","INI","LAN","LL","Math","OnlineScores","OS","Oxygen","PC","RAS","Registry","SAPI","SMTP","STAT","TBASS","TBDI","TBEM","TBGL","TcpUdp","Tokenizer","UI","UIAdv","VBRegExp","WMI","XPRINT","ZLIB"
dim iniOut as string = ";PSPad user HighLighter definition file"+ $CRLF + _
"[Settings]"+ $CRLF + _
"Name=THINBASIC"+ $CRLF + _
"HTMLGroup=0"+ $CRLF + _
"Label=0"+ $CRLF + _
"FileType=*.tbasic"+ $CRLF + _
"CommentString="+ $CRLF + _
"REMComment=1"+ $CRLF + _
"SinglQComment=1"+ $CRLF + _
"Preprocessors=1"+ $CRLF + _
"IndentChar="+ $CRLF + _
"UnIndentChar="+ $CRLF + _
"TabWidth=0"+ $CRLF + _
"DoubleQuote=1"+ $CRLF + _
"KeyWordChars=_$%"+ $CRLF + _
"CodeExplorer=ftVBS"+ $CRLF + _
"[KeyWords]"+ $CRLF + _
DIM sKeys AS STRING
DIM aKeys() AS STRING
DIM nKeys AS LONG
DIM Count AS LONG
'---Get a string with keywords separated by $TAB
sKeys = APP_ListKeywords
'---Parse string into an array
PARSE sKeys, aKeys, $TAB
'---Creates output buffer
nKeys = UBOUND(aKeys(1))
FOR Count = 1 TO nKeys
IF aKeys(Count) <> "REM" THEN
iniOut += aKeys(Count)+"=" + $CRLF
END IF
NEXT
iniOut += "[ReservedWords]"
'---Get a string with keywords separated by $TAB
sKeys = APP_ListEquates
'---Parse string into an array
PARSE sKeys, aKeys, $TAB
'---Creates output buffer
nKeys = UBOUND(aKeys(1))
FOR Count = 1 TO nKeys
iniOut += aKeys(Count)+"=" + $CRLF
NEXT
iniOut += "[KeyWords2]"+$CRLF+"[KeyWords3]"
file_save("ThinBasic.ini", iniOut)
Optional: Start PSPad, go to Settings/User higlighter and select this file.
Dialog will appear, just hit "SAVE" button.
Step #3: Adding filter
You will find Documents/<userName>/Application Data/PSPad/PSPad.ini and append the following to it (change things in bold to match your setup):
[THINBASIC]
Filter=THINBASIC (*.tbasic)|*.tbasic
HLTabWidth=2
IndentChar=
UnIndentChar=
Comment=000080001FFFFFFF010
Identifier=1FFFFFFF1FFFFFFF000
Key=008040001FFFFFFF100
Key words 2=004080FF1FFFFFFF100
Key words 3=1FFFFFFF1FFFFFFF100
Label=000000FF1FFFFFFF000
Number=008000001FFFFFFF000
Preprocessor=008080001FFFFFFF010
Reserved Word=004000801FFFFFFF100
Space=008080001FFFFFFF000
String=000000FF1FFFFFFF000
Symbol=1FFFFFFF1FFFFFFF000
Compilator File=E:\util\thinBasic\thinBasic.exe
Compilator Param=%File%
Compilator LOG=
Compilator Run=E:\util\thinBasic\thinBasic.exe
Compilator Help=E:\util\thinBasic\Help\thinBasic.chm
Compilator SaveAll=0
Compilator ParsLog=
Compilator Capture=1
Compilator HideOutput=0
Compilator DefaultDir=
Compilator LogType=0
Also do not forget to set value of UserHighLighterName (5th row of ini file)
UserHighLighterName=ThinBasic
Now you are finished. Just open tBasic files, and they will be highlighted correctly.
Ctrl+Shift+E brings you to code explorer, which allows you to navigate through Functions and Subs.
To run scripts, use Ctrl+F9.