Phantom Documentation

[Help Home] [Phantom Home]
Creating a Script

Any ASCII text editor can be used to create a Phantom script.  Generally, the script should have the extension '.psc'.  However, Phantom currently supports other extensions.

Scripts can contain any combination of Phantom commands, including variables, functions, flow control, and window operations. When a script is run using the Phantom interpreter, each command is executed in turn. Scripts can also be run from within another script using the 'include' command.

The following will take you through a step-by-step process of creating and executing a script:

1. Open any standard ASCII text editor (such as notepad or the DOS editor)
2.Type the following lines of code:

Example Code

# This is a Phantom Script
string Hello = "Hello, Welcome to Phantom!!!!";
disp(Hello);
# This is the end of the script



3. Save the script as 'mysample.psc' in the same directory that 'phantom.exe' is located.  (Note:  In Notepad, the extension may default to '.txt' yielding a script name 'mysample.psc.txt'.  If this is the case, change the name in the DOS prompt)


4. If you are not already at the DOS prompt, go to the DOS prompt.

5. Go to the directory in which phantom.exe is located

6. Type 'phantom.exe mysample.psc' and then enter

Congratulations!!!  You just ran your first script!  The output should have looked something like:

Output
FileName is: mysample.psc
-----------------------------------------
| Phantom v2.0                          |
| http://www.phantomtest.com            |
| This DOS version is freeware          |
| Type 'stop' to quit.                  |
-----------------------------------------
Hello, Welcome to Phantom!!!!



Analyzing the 'mysample.psc' script


The 'mysample.psc' is a simple demonstration of how the Phantom system works.  The first and last lines of the script were comments and ignored by the interpreter.  The second line created a 'string' variable and assigned it some data.  The third line printed that data to the screen.

That is really all there is to it to making and executing Phantom scripts.  Take a look at the included samples for an idea how a script interacts with windows and uses function files. Also, much of the sample code in this help document can be run as a Phantom script. Example code with lines beginning with line numbers (ex: 1 >>, 2 >>, etc) are console commands. To run them as a script, simply remove the line numbers and copy to a script.

Note: This example used the base DOS Phantom interpreter to run a script. The Phantom Test Driver (PTD) and Phantom Sidekick applications can also be used. To run a script using PTD or Sidekick, consult their respective documentation.


See Also: The Phantom Interpreter, Syntax, Functions, Output, Arguments




Copyright 2000-2011 Phantom Automated Solutions