PDA

View Full Version : Alternative IDE: PSPad



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.

ErosOlmi
26-08-2009, 08:23
Thanks a lot Petr.
I have PSPad installed since many year and I can say it does its job.

martin
26-08-2009, 09:48
Thanks a lot Petr, i just installed it and it looks good.

But I have 2 problems:
-I can't run my Thinbasic scripts, although the path is correct in the .INI file
-I don't like that vertical line at ruler position 80, is there a way to delete this line?

Still I hope that ThinAir problems will be solved soon, as I fall a little in love with this tiny editor. And I really hope that a scrollbar will be added in the Functions-combobox.

ErosOlmi
26-08-2009, 11:22
-I can't run my Thinbasic scripts, although the path is correct in the .INI file


Be sure to have "Compilator Param=%File%" setup. See red line below.
Also check full path to thinBasic.exe executable. It must be where you have installed thinBasic, usually c:\thiBasic\thinBasic.exe




[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=
Compilator Help=E:\util\thinBasic\Help\thinBasic.chm
Compilator SaveAll=0
Compilator ParsLog=
Compilator Capture=1
Compilator HideOutput=0
Compilator DefaultDir=
Compilator LogType=0

Petr Schreiber
26-08-2009, 20:39
Hi Martin,

that is weird. Does the syntax highlighting work ok for you at least?
What is the path of your ThinBASIC, does it contain spaces?


Petr

P.S. I also hope Roberto will become enthusiastic again.

Petr Schreiber
26-08-2009, 20:49
Removing vertical line at position 80 is ~easy:

- From menu choose "Settings / Program Settings"
- Choose "Editor (part 2)"
- Change number in "Position of Right Edge" to 1024

GSAC3
26-08-2009, 23:41
Petr:

I also am having the same problem as Martin with PSpad.

Everything seems to be set up correctly according to your instructions, however, I am unable to get CTRL+F9 to start a run.

Don

martin
27-08-2009, 07:13
that is weird. Does the syntax highlighting work ok for you at least?
What is the path of your ThinBASIC, does it contain spaces?


Hi Petr,

I am 100% sure that I spelled the corred path (no spaces in it). The syntax highlighting didn't work after copying the INI files. I configured everything via the menu.

I will take a look again today to see what's wrong

Martin

Michael Hartlef
27-08-2009, 10:03
Maybe the Ini file is in the wrong location.

Petr Schreiber
27-08-2009, 11:22
Don, Martin,

when you select File/Open, can you see THINBASIC (*.tBasic) as an option (last) in the file types box? If not, check if your [THINBASIC] section is still in the PSPad.ini.

In case you edited it while PSPad was running, it is possible it got deleted on the exit of program.

Could you post your PSPad.ini file here?

Petr

martin
27-08-2009, 12:15
Yes, I can see THINBASIC in the file types box

I attachted the INI file as TXT, otherwise I couldn't upload it here

Petr Schreiber
27-08-2009, 12:38
Hi Martin,

only difference I can see is that you dont have the [THINBASIC] section on the end but in the middle, and that you have the language set to NEDERLANDS.

I would recommend to check if ThinBASIC.ini is still really in Syntax directory, I don't see what else could be wrong :oops:

martin
27-08-2009, 12:53
Hi Petr, I just moved the thinbasic section to the bottom and set language to english, but without succes. Also thinbasic.ini is in the Syntax directory and pspad.ini is stored in C:\Documents and Settings\Martin\Application Data\PSpad

But no problem, i can still use ThinAir, as long as I don't press CTRL Z ;)

Martin

Petr Schreiber
27-08-2009, 13:03
I am sorry to hear that.

I uninstalled PSPad, and did everything from scratch to make sure the approach will work for everyone :(

GSAC3
27-08-2009, 17:45
Petr:

I uninstalled PSpad, downloaded the most recent version, and reinstalled it.

After the reinstall, and before I made any of your changes, I looked at the PSpad.INI file in the Application Data/PSpad subdirectory and noticed there was already a [THINBASIC] section appended at its end. I removed it and added the [THINBASIC] section which you'r code generated for me on my system and modified it to suite the location of the thinBasic.exe and HELP files. With this configuration, the highlighting was working, but I still could not get the CTRL+F9 to work. So I removed the [THINBASIC] section of the PSpad.INI file replaced it with the [THINBASIC] section I had previously removed. After updating this version of [THINBASIC] to properly reflect where thinBasic.exe and its HELP files were located on my PC, I tried using CTRL+F9 again. SUCCESS! This time everything worked OK. Attached are the two different versions of the [THINBASIC] sections I was working with.

THINBASIC_1.TXT is the version created using your generator (doesn't work)

THINBASIC_2.TXT is the version that was apparently provided during the PSpad install process (works).

You can see the slight differences by comparing the two files.
I hope this is helpful.

Don

Petr Schreiber
27-08-2009, 17:52
Hi Don,

thanks for your tests, it seems I forgot to fill Compilator run item.
I updated the text in first post.


Thanks!,
Petr