Using Notepad++

From SysCAD Documentation
Jump to: navigation, search

Navigation: User Guide -> Editors and Utilities

Introduction

We have successfully been using Notepad++ for writing Control Program files - PGM and MP files, as well as Archive report configuration files (SAC files). We have found that it to be an excellent alternative to Notepad.

With all the features it provides, Notepad++ (see http://notepad-plus-plus.org ) makes it easier to see and edit code. Therefore, we highly recommend our SysCAD users install it.

It is free to download and install under the GPL (GNU General Public License).

NOTES:

  1. The following instructions are valid for Notepad++ version 7.5 or earlier;
  2. Function auto-completion and tips are only available with Notepad++ version 6.3 and later.
  3. Please download the latest version of Notepad++ and the required SysCAD xml files from our download site (https://www.syscad.net/login/), if you do not have all of the files described below.

Notepad++ Features

  1. Display line numbers;
  2. Colour coding of keywords, normal code, comments etc.;
  3. Auto-complete for SysCAD keywords and functions;
  4. Short tips with descriptions for functions;
  5. Drag and drop editing for copying and moving between documents;
  6. Block (column) selection mode, and visible display of tabs and spaces;
  7. Text can be automatically aligned and indented, relative to previous line, to aid block indentation;
  8. Highlight all occurrence of the current selection for easy debugging of logic;
  9. Search and Replace in Files (for multi-file editing);
  10. Other features can be found on this site: http://notepad-plus-plus.org/features.

For example, comparison between Notepad and Notepad++, some features from the above list are shown in the image below, marked by the corresponding numbers:

Notepad.png

Installing Notepad++

Step 1: Locate Notepad++ Install File

Notepad++ together with the relevant User Defined Language Files for SysCAD can be found from one of the following 2 locations:
  1. Included with the SysCAD Install:
    • After SysCAD is installed, the notepad++ install package can be found in folder: \SysCADxxx\Setup\Notepad++\npp.xxxx.Installer;
  2. Downloaded from SysCAD Downloads Page: https://www.syscad.net/login/
    • Downloads page | SysCAD 9.3 (requires Username and Password) | Notepad++ (Install File) and SysCAD Notepad++ Files (User Defined Language Files).
User may check for the latest version of Notepad++ on: http://notepad-plus-plus.org,

Step 2: Run the Install File

Once you have located the Notepad++ install file:
  1. Run the Install program.
  2. The default location for Notepad++ is C:\Program Files (x86)\Notepad++\ - you can change this location if required.

Step 3: Setting up Keyword highlighting

Once the install is complete start Notepad++, and follow the steps below to enable keyword highlighting:
  1. Select Language from the Menu;
  2. Click on Define your language;
  3. Click the import Button;
  4. Import the SysCADLanguage.xml file (or the UserDefineLang.xml file for earlier versions of SysCAD) located in SysCAD Install Folder\Setup\Notepad++
  5. Close and restart Notepad++ for the changes to take effect.
  6. If colours are not visible when Notepad++ restarts, go to menu option "Language" and select "SysCAD PGM" from the List of User Defined Languages.

Step 4: Setting Up Auto-complete Functions and Keywords

Once the install is complete follow the steps below to enable auto-complete functionality:
  1. Copy the file 'SysCAD PGM.xml' from the SysCAD Install Folder\Setup\Notepad++ to ..\Notepad++\plugins\APIs
  2. Start Notepad++;
  3. Select 'Settings - Preferences' from the Menu;
  4. Click on the 'Auto-Completion' tab or 'Auto-Completion' in the menu, depending on the version of Notepad++;
  5. In older versions of Notepad++ tick the following Buttons:
    • Enable auto-completion on each input;
    • Function completion;
    • Function parameters hint of input.
  6. In newer versions of Notepad++, set up the preferences as shown in the image below:
    Notepad++ Preferences.png
  7. Click on 'Close' and this functionality will be available for pgm and mp files.
  8. Do note that you can change the preferences at any stage.

Step 5: Configuring SysCAD to use Notepad++

In SysCAD, from menu Tools | General Options on the “Global” Tab page, use the file browse button next to the Text Editor field to browse for Notepad++ - see below. (The Notepad++ folder is normally located in the Program Files folder)
If Notepad++ was installed in the System default folder, then user may simply press the Defaults button to automatically enter the location.
General options.png
Once this is done, the next time you press the Edit_PGM or Edit Archive button in SysCAD, Notepad++ will start up.
Editing other types of referenced text files from SysCAD will also be in Notepad++.

Customising Notepad++

  1. To change your Tab size and change tabs to spaces select Settings|Preferences|Language Menu/Tab Settings.
  2. To display line numbers Select Settings|Preferences|Editing and check Display line number.
  3. To decrease the line spacing Select Settings|Style Configurator|Global Styles|Brace Highlight Style and change the font size to 8.
  4. To open a blank template for each new session select Settings|Preferences|MISC. and ensure that Remember current session for next launch is NOT ticked. (Valid for v6.4.5)


Troubleshooting

Syntax Colours not Visible

If you have installed Notepad++ and set SysCAD up to use this as the default text editor, but the PGM files do not display colours for the key words. It is likely that the User Defined Language (file SysCADLanguage.xml or userDefineLang.xml in Notepad++ installed folder) has not been added or configured correctly for SysCAD.

Possible Solutions:

  1. The User Defined Language for SysCAD has not been added. Import the user defined language for SysCAD as follows:
    1. Open Notepad++;
    2. Select Language from the Menu;
    3. Click on Define your language;
    4. Click the import Button;
    5. Import the SysCADLanguage.xml file (or userDefineLang.xml file) located in \SysCADxxx\Setup\Notepad++
    6. Exit and restart NotePad++.
    7. If colours are still not visible when Notepad++ restarts, go to menu option "Language" and select "SysCAD PGM" from the List of User Defined Languages.


If using v5.8 or earlier please try this:

  1. Re-install Notepad++. At the 'Choose Components' step ensure that you tick "Don’t use %APPDATA%". This is very important, if you do not check this component then Notepad++ will not recognise the key pgm words.
    It is possible that an install may not "repair" the installed version, in this case uninstall first and then reinstall.

Repairing or updating User Defined Language

To update (or repair) the files required for colour syntax of SysCAD files, follow these steps:

  1. Open Notepad++;
  2. Select Language from the Menu;
  3. Click on Define your language;
  4. From the User Language drop-down menu select SysCAD PGM;
  5. Click Remove;
  6. Repeat the above 2 steps for SysCAD Reaction and SysCAD Archive;
  7. Close and Restart Notepad++ for the changes to take effect.
  8. Re-import the correct or updated SysCADLanguage.xml file (or userdefinelang.xml file) provided with SysCAD as follows:
    • Select Language from the Menu;
    • Click on Define your language;
    • Click the import Button;
    • Import the SysCADLanguage.xml file (or userdefinelang.xml file) located in \SysCAD92\Setup\Notepad++;
    • Exit and restart NotePad++.
  9. If colours are still not visible when Notepad++ restarts, go to menu option "Language" and select "SysCAD PGM" from the List of User Defined Languages.