TextPad Installation and Setup

TextPad is a very powerful text editor for Windows. The following instructions show how you can install it and configure it for use with Gsharp.

Installation of TextPad

  • You can download the latest version of textpad from http://www.textpad.com
  • The instructions below assume you are using TextPad 4.2 or later.

Creating a GSL Document Class

  • Copy the gsl.syn file from $UNIDIR/misc/Gsharp to the Samples sub-folder of the TextPad Installation.
  • From the Configure menu choose "New Document Class ..."
  • Set the document class to be "Gsharp"
  • Set the class members to be "*.gs?"
  • Select "Enable syntax highlighting"
  • Set the "syntax definition file" to be "gsl.syn"
  • Click on "Finish" to create the class.

Configuring the GSL Document Class

  • From the Configure menu choose "Preferences..."
  • In the list of sections on the left hand side, click on the small plus next to Classes. This displays all of the classes defined in TextPad.
  • Select the Gsharp class.
  • Configure the Gsharp class to your own preferences.

Configuring TextPad

Other options you might like to consider setting are:
  • View - Line numbers
  • Associated Files - add gsl, gsa and gsw
  • File name filters - Gsharp files (*.gs?)

Adding Gsharp and GsharpApp as Tools

  1. From the Configuration Menu choose Preferences
  2. Select Tools at the bottom of the list of sections.
  3. Click on Add - Program ...
  4. Select Gsharp.exe from the bin directory of the Gsharp installation.
  5. Click on Apply - Gsharp is added as a new tool.
  6. Click on the Gsharp section that has appeared on the left hand side.
  7. Make sure that the Parameters are set to "$File" and "$FileDir" (you may wish to add "-logo" to the parameters or set your own initial directory).
  8. You may also wish to opt to "Save all documents first"
  9. Ignore, for the moment, options to capture output.

N.B. You can now run the script you are editing by pressing "Ctrl-1".

Repeat for GsharpApp.

Adding Gsharp Syntax Checker as a Tool

If you want to be able to check your GSL syntax before running Gsharp then follow the instructions below. N.B. These instructions do not currently work with .gsa files.
  1. From the Configuration Menu choose Preferences
  2. Select Tools at the bottom of the list of sections.
  3. Click on Add - "DOS Command..."
  4. Type "Gsharp -syntax" for the DOS command.
  5. Click on Apply
  6. Click on the "Gsharp -syntax" section that has appeared on the left hand side.
  7. Enter the following as the parameter "c:\gsharp\7v2\bin\gsharp.exe -syntax $File". You may need to adjust the path to your Gsharp executable.
  8. Make sure "Capture Output" is selected.
  9. Set the regular expression to be:
  10. ^line \([0-9]+\) in \([A-Z]:[^:]+\):.*$

  11. Under Registers, set File to be "2" and Line to be "1"
  12. Click on OK.

When you run Gsharp -syntax, the current file (and any files that it includes) will be syntax checked and any error messages will appear in the Command Results window. Double-click on an error message to go straight to the appropriate line.

Adding Your Gsharp Application as a Tool

If you are developing an application based on Gsharp. Follow these instructions to start your application from TextPad regardless of the current file that is being edited.
  1. From the Configuration Menu choose Preferences
  2. Select Tools at the bottom of the list of sections.
  3. Click on Add - Program ...
  4. Select GsharpApp.exe (or Gsharp.exe) from the bin directory of the Gsharp installation. N.B. You only need to use Gsharp.exe if your application uses the ScriptBuilder, DataManager, HierarchyBrowser or any of the Resource Editors.
  5. Click on "GsharpApp" in the list and change the name to the name of your application.
  6. Click on Apply - Your application is added as a new tool.
  7. Click on the new section that has appeared on the left hand side.
  8. Set the Parameters field to be the .gsa file of your application, together with "-logo" if you want to disable the start-up logo.
  9. Set the "Initial folder" to the folder containing your data files.
  10. You may also wish to opt to "Save all documents first"
  11. Click on OK.