Operation

The GUM Tree Calculator (GTC.exe) can be activated from the Windows Command Prompt, from the Windows PowerShell (in Windows 10) or from the Windows Explorer extended context menu.

The SciTE editor, with context sensitive syntax highlighting and help facilities, is also provided.

The Command Prompt

There are several ways to use GTC from the Windows command prompt or the Windows PowerShell (see also Windows command prompt syntax) [1].

The GTC command line interpreter.
  1. When run without arguments, GTC enters an interactive mode.

For instance:

>>> print copyright
Copyright (c) 2017, Callaghan Innovation. All rights reserved.
>>> print version
0.9.9
>>> 2**16 + 1
65537

To close the command window, type:

quit()

or CTRL-Z (press the CTRL key and the Z key together) at the command prompt.

  1. GTC can execute data-processing scripts passed to it on the command-line

    For example, a file hello.py that contains:

    msg = 'Hello'
    print(msg)
    

    can be executed by:

    C:\> gtc hello.py
    Hello
    
A series of scripts can be passed to GTC on a single command line, allowing calculations to be chained
  1. After processing scripts, GTC can be placed in an interactive mode, allowing further commands to be entered in by hand. The command-line switch -i selects interactive mode, e.g.:

    C:\> gtc -i hello.py
    Hello
    
    >>> print(msg)
    Hello
    >>>
    

Help

Information about a particular GTC command, or module, can be obtained by typing help(subject) at the command prompt [2].

Help about the `ureal` function

If the help text is too long to fit in the command window, -- more -- will appear at the bottom. To display the next line of text, press ENTER, or to display the next full page of text press the space bar.

A help text that does not fit in the available window

To leave the Help facility, type: CTRL-C.

Explorer context menus

Two options are available in the ‘extended’ Explorer context menu. A GTC item has also been added to the Explorer SendTo facility.

Extended context menu items for folders and files

Pressing the Shift key while right-clicking on a file or folder in the right-hand pane of the Windows Explorer activates the ‘extended’ context menu.

The extended context menu showing `Open command window here` as an option
  1. When a folder is selected, the menu item Open command window here opens a Windows Command Prompt in the folder (see command_line). (Note, on Windows 10 the Open command window here item has been replaced by an Open PowerShell window here item. GTC can be also run from the PowerShell.)
  2. When a file with a .py extension is selected, the Edit with SciTE (GTC) option will appear (see scite_editor).
The extended context menu showing `Edit with SciTE` as an option

Context menu SendTo

The SendTo item in the Windows Explorer context menu passes a file to GTC for execution. After processing, GTC will remain in interactive mode (see command_line).

The context menu showing a `SendTo` option for GTC

The SciTE editor

The SciTE editor

The SciTE editor can be activated in two ways:

  • There is a link to SciTE in the GTC Start Menu.
  • In the Windows Explorer, pressing SHIFT while right-clicking on a file with the .py extension activates a context menu with an item Edit with SciTE (GTC).

SciTE editor will highlight the language syntax. It has a command-completion feature that provides information about commands as they are typed in. The GTC and Python Help files are also integrated.

Executing scripts

SciTE can be used to write and execute scripts:

The SciTE editor after executing a script
  • The Go command (function key F5, or menu selection Tools | Go) executes the current file.

  • The Interactive Mode (press CTRL-3 or select the Tools | Interactive Mode menu item) executes the current file, leaving the interpreter in interactive mode. Commands can then be entered at the >>> prompt in the SciTE output window.

    To close an interactive session in SciTE, type:

    quit()
    

    (CTRL-Z does not work in SciTE)

Note

Commands can be typed at the >>> prompt in the SciTE output window. However, basic editing features (such as a recalling previous command, command completion, etc) are not available.

In particular, it is impossible to correct any typing mistakes by pressing the Backspace key. Doing so erases characters from the display, but it does not remove them from the editor’s buffer.

Help inside SciTE

Pressing F1 opens the GTC help file.

Typing CTRL-4 opens the Python help file.

If a word is selected before pressing either of these help keys, the Help file index is automatically searched for a reference to the word.

[1]Under Windows 10, the default font size and family used by the Command Prompt has been changed from earlier Windows versions. We prefer to modify these default settings to size 16 Courier New. To do this: right-click on the GTC shortcut in the GTC item of the Windows Start menu; select properties; select the font tab; change the font family and size; save these settings. Note too that under the layout tab it is possible to change the window size.
[2]When Help is displayed in the Command Prompt, some embedded formatting (mark-up) is visible. For example, :arg:, :type: and :rtype: are formatting commands.