PTD includes a command console that starts automatically when PTD
starts. The command console can be used to run any Phantom command
or script. Resulting output is displayed directly in the console,
including any error or warning information.
The console is useful for learning how to use new Phantom commands
and prototyping new code. It can also be used to invoke Phantom functions
specially designed for the console, such as the what() and who() functions
(see the Phantom Language documentation).
To use the Console, start PTD and select the Console tab in the PTD
output area:
Alternatively, if the console has been closed or a new console is
to be opened, select Console from the Run menu:
Once the console is active, any Phantom command can be typed in the
console. Once the Enter key is pressed, the command is processed by
the Phantom engine. Note that the console has the same text color-coding
as the main script editor.
Previous commands can be cycled by pressing the up and down keys on
the keyboard.
Useful Phantom Console Commands
Below is a brief description of some Phantom commands useful for console
operations:
- what() –
Displays a list of available Phantom function packages. If used
with a string parameter of the package name, displays a list of
functions available in that package.
- who() –
Displays a list of global variables, including the type, name, and
value.
- include –
Used to run a separate Phantom script from the console.
- members() –
Displays a list of member variables and member functions associated
with a particular data type.
- disp() –
Displays the parameter.
See the Phantom documentation for more information on the usage of
these functions.
Printing the Console
The console output can be sent to the printer by selecting ‘Print’
from ‘Output’ in the main menu.
The console output will be printed as it appears, with the addition
of line numbers displayed on the left. Note that the console must
be selected and displaying the keyboard cursor in order to print the
console output.