GS Scripter Help
GS Scripter Overview

Press F1 for information on how to use Help.

The GS Scripter program is a BASIC-like interpreter that loads and executes scripts (also called macros).  GS Scripter is automatically installed when you run the Golden Software Setup program, and a GS Scripter icon is placed in the Golden Software group.

GS Scripter consists of two windows.  The GS Scripter Edit window is a standard Windows ASCII text editor that allows you to open, create, edit and save ASCII text files.  Scripts are executed from the GS Scripter Edit window.  The Output window displays the output from any PRINT commands specified in the macro file.  The Output window is not visible until a PRINT statement is executed in a script.

Scripts are text files created within GS Scripter, an Editor window, Windows Notepad, or any ASCII editor of your choice.  When a script file is displayed in the GS Scripter Edit window, you can run the script.  The operations specified in the script will be carried out.  Scripts executed from the GS Scripter Edit window can contain commands necessary to automatically run any OLE 2.0 compliant program.

For a general discussion of macro scripts, see Macro Script Overview

For a complete list of GS Scripter Functions, see Functions and Statements - Alphabetic List.

See Also

Functions and Statements - Alphabetic List

GS Scripter Commands

GS Scripter Language Syntax Topics

Keystrokes Utilized by GS Scripter

Macro Script Overview

Modes for Running Scripts

OLE 2.0 Automation

Opening a Script File

Running a Script

Sample Surfer Script Files

Saving Script Files

Surfer Macro Commands

Using GS Scripter to Write a Macro

What are Macro Script Files?


GS Scripter Language Syntax Topics

Arrays

Functions and Statements - Alphabetic List

Labels

Object Property Values

Operators

Reserved Words

Rules for Statements, Functions and Commands

Using Functions

Variables


GS Scripter Commands

File Menu

New clears the GS Scripter window

Open opens a script [.BAS] file

Save saves the script in the GS Scripter window

Save As saves the script in the GS Scripter window to a new name

Exit ends the current GS Scripter session

Edit Menu

Undo reverses the last change made to the script

Cut removes the selected text and makes a copy of it in the Windows Clipboard

Copy copies the selected text to the Windows Clipboard

Paste pastes the Clipboard contents at the current insertion point in the script

Delete removes the selected text from the GS Scripter window

Select All selects all the text in the GS Scripter window

Run Menu

Start executes the current script from beginning to end

Break suspends execution of the script at the current position in the script.

Continue resumes operation at the point where it was suspended by the Break command.

Restart begins a paused script over at the beginning

End terminates script execution

Trace steps through a script one line at a time


File New

The New command clears the GS Scripter Edit window.

If you have made any changes to the current script and have not saved the file, you are prompted to save any changes to the file.  Click Yes to save any changes, No to clear the window without saving the changes, or Cancel to return to the window and retain the current script.

See Also

File Open

File Save

File Save As

File Exit

GS Scripter Overview

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro


File Open

The Open command displays the Open Document dialog box that allows you to select the [.BAS] script file to be opened.  Specify the path and file name for the file to be opened and click OK.  The selected script file is displayed in the GS Scripter Edit window.

If you have made any changes to the current script and have not saved the file, you are prompted to save any changes to the file.  Click Yes to save any changes, No to clear the window without saving the changes, or Cancel to return to the window and retain the current script.

See Also

File New

File Save

File Save As

File Exit

GS Scripter Overview

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro


File Save

The Save command saves any changes you have made to the current script file.  The file uses the current path and file name for saving the file.

If you have not previously saved the file (i.e. it is a new script), the Save As dialog box is displayed.  You can specify the path and file name to use for the new script.

See Also

File New

File Open

File Save As

File Exit

GS Scripter Overview

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro


File Save As

The Save As command displays the Save As dialog box.  You can specify the path and file name for the file to be saved.  If you do not include an extension, the file automatically is assigned a [.BAS] extension.

See Also

File New

File Open

File Save

File Exit

GS Scripter Overview

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro


File Exit

The Exit command closes the GS Scripter Edit window.

If you have made any changes to the current script and have not saved the file, you are prompted to save any changes to the file.  Click Yes to save any changes, No to clear the window without saving the changes, or Cancel to return to the window and retain the current script.

See Also

GS Scripter Overview

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro


Edit Undo

The Undo command reverses the last change made to the script.

See Also

Edit Cut

Edit Copy

Edit Paste

Edit Delete

Edit Select All

GS Scripter Overview

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro


Edit Cut

The Cut command makes a copy of the selected text in the Clipboard.  This command removes the selected text from the window.

See Also

Edit Undo

Edit Copy

Edit Paste

Edit Delete

Edit Select All

GS Scripter Overview

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro


Edit Copy

The Copy command makes a copy of the selected text in the Clipboard.  This command retains the selected text in the GS Scripter Edit window.

See Also

Edit Undo

Edit Cut

Edit Paste

Edit Delete

Edit Select All

GS Scripter Overview

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro


Edit Paste

The Paste command places a copy of the current Clipboard contents in the GS Scripter Edit window at the insertion point.  Only text can be pasted to the GS Scripter Edit window.

See Also

Edit Undo

Edit Cut

Edit Copy

Edit Delete

Edit Select All

GS Scripter Overview

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro


Edit Delete

The Delete command deletes the currently selected text from the GS Scripter Edit window.

See Also

Edit Undo

Edit Cut

Edit Copy

Edit Paste

Edit Select All

GS Scripter Overview

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro


Edit Select All

The Select All command selects all text in the GS Scripter Edit window.

See Also

Edit Undo

Edit Cut

Edit Copy

Edit Paste

Edit Delete

GS Scripter Overview

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro


Run Start

The Start command executes a script from beginning to end.  Script execution only stops when the end of the file is reached, you choose the Break command (or type CTRL+BREAK), a STOP statement is executed, or an error is encountered.

When a script is running, the Start command changes to the Break (or CTRL+BREAK) command that lets you suspend the execution of the script.  The Break command is changed to the Continue command.

The Continue command resumes operation at the point where it was suspended by the Break command.

The Restart command can also be used to resume program execution after a Break command.  In this case, script execution begins from the beginning.

Keyboard Shortcut

F5

See Also

Break

Continue

Restart

End

Trace

Edit Mode

Run Mode

Stopped Mode

Trace Mode

GS Scripter Overview

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro


Run Break

When you choose the Start command or press the F5 key, the Start command changes to the Break command.  The Break command suspends execution of the script at the current position in the script.

When you choose the Break command, it changes to the Continue command.  The Continue command resumes operation at the point where it was suspended by the Break command.

Keyboard Shortcut

CTRL+BREAK

See Also

Start

Continue

Restart

End

Trace

Edit Mode

Run Mode

Stopped Mode

Trace Mode

GS Scripter Overview

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro


Run Continue

When you choose the Break command during script execution, the Break command changes to the Continue command.  The Continue command resumes operation at the point where it was suspended by the Break command.

See Also

Start

Break

Restart

End

Trace

Edit Mode

Run Mode

Stopped Mode

Trace Mode

GS Scripter Overview

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro


Run Restart

The Restart command restarts a script from the beginning.  When a script is suspended by a STOP statement or by using the Break (or CTRL+BREAK) command, you can choose the Restart command to begin script execution from the beginning.

Keyboard Shortcut

SHIFT+F5

See Also

Start

Break

Continue

End

Trace

Edit Mode

Run Mode

Stopped Mode

Trace Mode

GS Scripter Overview

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro


Run End

The End command terminates script execution.

See Also

Start

Break

Continue

Restart

Trace

Edit Mode

Run Mode

Stopped Mode

Trace Mode

GS Scripter Overview

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro


Run Trace

The Trace command steps through the script one line at a time.  At the end of each line, program execution is suspended until you choose the Trace command again, or press the F8 key.

Keyboard Shortcut

F8

See Also

Start

Break

Continue

Restart

End

Edit Mode

Run Mode

Stopped Mode

Trace Mode

GS Scripter Overview

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro


Macro Script Overview

A macro is a script that controls program operation automatically.  You can do practically everything with a script that you can do manually with the mouse or from the keyboard. Scripts can be used to automate a sequence of tasks, automate repetitive tasks, or to act as a "front-end" so users unfamiliar with applications can still access their capabilities.

Scripts can be created and executed from GS Scripter.  To create scripts, you can use GS Scripter as an ASCII editor to type and edit the script.  Then you run the script from GS Scripter and the procedures specified in the script are carried out.

See Also

GS Scripter Overview

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro

What are Macro Script Files?


What are Macro Script Files?

Macro scripts are ASCII text files.  To create a script you must type in the script text, or edit an existing script.  GS Scripter, because it functions as an ASCII text editor, allows you to type and edit scripts.  When you want to create a new script that is specific for your application, you will most likely start with an empty GS Scripter Edit window and type the entire script.  If you want to perform a routine task, you can probably open an existing script file and edit the file to meet your specific needs.

When a script file is displayed in the GS Scripter Edit window, you can execute the script and the included commands are carried out.

See Also

GS Scripter Overview

Macro Script Overview

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro


OLE 2.0 Automation

GS Scripter supports OLE 2.0 Automation.  OLE 2.0 Automation packages commands and command arguments and sends them to OLE 2.0 compatible programs.  For example, when GS Scripter executes a macro, OLE packages the commands and sends them to the OLE2 compliant program.  That program then automatically starts up and executes the commands passed to it by OLE.

GS Scripter can be used to drive any OLE 2.0 automation-compliant programs.  For example, GS Scripter can be used to write macros that work with Microsoft Excel.


Using GS Scripter to Write a Macro

GS Scripter allows you to create a macro file.  To write a macro:

1.	Double-click the GS Scripter icon to display the GS Scripter Edit window.  If GS Scripter is already running, you can choose New from the GS Scripter File menu, save any changes to any existing script, and an empty window is displayed.

2.	To create a macro, type the commands and command arguments in the GS Scripter Edit window.  Because the GS Scripter is a standard ASCII editor, the common Windows text editing keystrokes are supported.

3.	At the top of the script, define the object variable so OLE 2.0 knows that the command following the variable name is meant for the specified application.

For example, GS Scripter can be used to create the Surfer object variable in this way:

SET srf = CreateObject("Surfer.APP")

4.	Type in the BASIC functions and commands to define the operations for your macro.

For example, to carry out a Surfer specific task, type in the Surfer object variable (in this case, srf is the defined variable), followed by a period and the specific script command and any associated arguments.  For example, "srf.griddata" is the command necessary to run the Data command from the Surfer Grid menu.  This is followed by any command arguments specifying the gridding parameters to use.  Whenever arguments are omitted from the command, Surfer uses the current default settings.  The command might appear as

srf.GridData("data1.dat",gridmethod = 0)

in your script.

5.	When completed, you can choose the Save As command from the File menu and save the script file to an ASCII text file.

See Also

GS Scripter Overview

Macro Script Overview

Opening a Script File

Running a Script

Saving Script Files

What are Macro Script Files?


Keystrokes Utilized by GS Scripter

Because the GS Scripter is an ASCII editor, the common Windows text editing keystrokes are supported.  Below is a list of the keys and their functions in the GS Scripter Edit window.

F2	selects all text.

F5	starts macro execution.

SHIFT+F5	resumes macro execution following a pause.

F8	starts Trace mode.

CTRL+O	opens a text file.

CTRL+S	saves a text file

CTRL+A	saves a text file to a new name or location.

CTRL+Z	undoes the last operation performed.

CTRL+X or SHIFT+DEL	cuts the highlighted text to the clipboard.

CTRL+ C or CTRL+INS	copies the highlighted text to the clipboard.

CTRL + V or SHIFT+INS	pastes the highlighted text to the clipboard.

DEL	erases a character to the right of the cursor or erases all highlighted characters.

ARROW	moves in the direction of the arrow.

BACKSPACE	erases a character to the left of the cursor or erases all marked characters.

CTRL+LEFT ARROW	moves to beginning of previous word.

CTRL+RIGHT ARROW	moves to beginning of next word.

SHIFT+LEFT ARROW	highlights the previous character.

SHIFT+RIGHT ARROW	highlights the next character.

SHIFT+CTRL+LEFT ARROW	highlights the previous word.

SHIFT+CTRL+RIGHT ARROW	highlights the next word.

SHIFT+UP ARROW	highlights the line of text from the current cursor position to the same position on the line above.

SHIFT+DOWN ARROW	highlights the line of text from the current cursor 	position to the same position on the line below.

HOME	moves to beginning of line.

CTRL+HOME	moves to beginning of text block.

SHIFT+CTRL+HOME	highlights to beginning of text block.

END	moves to end of  line.

CTRL+END	moves to end of text block.

SHIFT+CTRL+END	highlights to end of text block.

ENTER	begins a new line.

See Also

GS Scripter Overview

Macro Script Overview

Modes for Running Scripts

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro

What are Macro Script Files?


Saving Script Files

Script files are ASCII text files, and can be created and saved from any program that allows you to create and save ASCII text files.  By default, GS Scripter expects a [.BAS] extension on the script files, although any extension can be used as long as the file format is correct.  If you are using a program other than GS Scripter to create the script files, refer to the documentation for your program to find out how to save files in the ASCII text file format.

1.	After you have created a script file in GS Scripter, and want to preserve the file for use at a later time, choose the Save As command from the File menu and the Save As dialog box is displayed.

2.	Type in the name for the file to be saved.  If you do not include an extension, a [.BAS] extension is automatically added to the file.

3.	If necessary, specify the Drive and Directory where you want to save the file.

4.	Click OK and the file is saved.

See Also

GS Scripter Overview

Keystrokes Utilized by GS Scripter

Macro Script Overview

Modes for Running Scripts

Opening a Script File

Running a Script

Using GS Scripter to Write a Macro

What are Macro Script Files?


Opening a Script File

Before you can execute a script, you must open the script file in the GS Scripter Edit window.

1.	When you want to run a script you have saved on disk, choose the Open command from the File menu and a list of [.BAS] files is displayed.

2.	Double-click the [.BAS] file for your script and the file is displayed in the GS Scripter Edit window.

3.	To run the script, press the F5 key or choose the Start command from the Run menu.

You can also specify a script file from GS Scripters command line.

To open a file for editing enter the command:

GSMAC filename   (16-bit version)

GSMAC32 filename (32-bit version)

To open a file and automatically run it you can use the /x switch in this way:

GSMAC /x filename   (16-bit version)

GSMAC32 /x filename (32-bit version)

More than one script can be executed with multiple /x commands:

GSMAC /x filename1 /x filename2 /x filename3   (16-bit version)

GSMAC32 /x filename1 /x filename2 /x filename3 (32-bit version)

See Also

GS Scripter Overview

Keystrokes Utilized by GS Scripter

Macro Script Overview

Modes for Running Scripts

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro

What are Macro Script Files?


Running a Script

The Run menu contains the commands controlling script execution.  There are three modes for running scripts: Run mode, stopped mode and trace mode.  To run a script, it must be displayed in the GS Scripter Edit window, then you can choose the appropriate command from the Run menu.

To run a script:

1.	Double-click the GS Scripter icon from the Golden Software group.

2.	Create a new script in the GS Scripter Edit window, or open a script file.

3.	When the script file is displayed in the window, press the F5 key or choose the Start command (the Run Mode) from the Run menu and the macro is executed from start to finish.  Refer to the section below for more information on the run mode.

4.	If you want to proceed through a script on line at a time, press the F8 key or choose the Trace command (the Trace Mode) from the Run menu.  Each time you press F8 GS Scripter executes the next line in the script.

You can also open and automatically run a script from the GS Scripter command line.  To open a file and automatically run it you can use the /x switch in this way:

GSMAC /x filename   (16-bit version)

GSMAC32 /x filename (32-bit version)

More than one script can be executed with multiple /x commands:

GSMAC /x filename1 /x filename2 /x filename3   (16-bit version)

GSMAC32 /x filename1 /x filename2 /x filename3 (32-bit version)

See Also

GS Scripter Overview

Keystrokes Utilized by GS Scripter

Macro Script Overview

Modes for Running Scripts

Opening a Script File

Saving Script Files

Using GS Scripter to Write a Macro

What are Macro Script Files?


Modes for Running Scripts

There are different modes under which GS Scripter operates.  The behavior of the program might be somewhat different during each of these modes.  For information on the different modes, click the appropriate topic listed below.

The different modes are:

Edit Mode

Errors During Script Execution

Run Mode

Stopped Mode

Trace Mode

See Also

GS Scripter Overview

Keystrokes Utilized by GS Scripter

Macro Script Overview

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro

What are Macro Script Files?


Edit Mode

During editing mode two commands Start and Trace are available from the Run menu.   Selecting the start command will run the script that is showing in the editor window.  Selecting the Trace command will execute a single script line and then enter pause mode (as if a STOP statement had been executed).

While a program is running most commands are disabled.  You cannot open or save files, but you can exit the program.   You cannot edit text, but you can scroll through it.  On the Run menu, the start command is replaced with Break, and the end command becomes active.  Help is also available while a script is running.

Selecting the Break command (or Ctrl-Break) while a script is running will pause the script execution.  Selecting the end command will terminate execution and return you to edit mode.

During the paused mode the commands available are similar to those available during run mode.  Unlike run mode, typing text into the edit window is allowed.  Typing new text, however, will cause the program to revert to edit mode.   On the Run menu the Start (or Break) command is replaced with Continue.  The continue command will cause script execution to resume from where it was stopped.  The Restart command is also available.  This command is essentially the same as the start command.  The only difference is that the basic interpreter's intermediate code is still in memory, so execution will begin immediately.  During paused mode the End command is still active and it has the same function as during run mode.

See Also

Errors During Script Execution

Run Mode

Stopped Mode

Trace Mode

GS Scripter Overview

Keystrokes Utilized by GS Scripter

Macro Script Overview

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro

What are Macro Script Files?


Run Mode

Run mode executes a script from beginning to end, and only stops when the end of the script is reached, a STOP statement is executed, or when an error is encountered.  This is the normal mode for running scripts.  When a script is running, the Start command is changed to the Break command.  Choosing the Break command (or CTRL+BREAK) allows you to suspend operation of the script.  When you choose the Break command or type CTRL+BREAK, the Break command is then changed to the Continue command.  The Continue command resumes the operation at the point where it was suspended.  While a script is running most commands are disabled.  You cannot open or save files, but you can exit the program.   You cannot edit text, but you can scroll through it.  The End command becomes active during Run mode, allowing you to terminate script execution.  Help is also available while a script is running.

See Also

Edit Mode

Errors During Script Execution

Stopped Mode

Trace Mode

GS Scripter Overview

Macro Script Overview

Opening a Script File

Running a Script

Saving Script Files

Using GS Scripter to Write a Macro

What are Macro Script Files?


Trace Mode

Trace mode executes the script one line at a time, so the macro is paused after each line.  To enter the trace mode, choose the Trace command from the Run menu, or press the F8 key, and the first line in the script is executed.  Each time you choose the Trace command or press F8, the next line in the script is run.  Trace mode is helpful if you need to monitor the progress of the script line to line.  If you are having problems with a script, this mode is helpful in finding the problem.

See Also

Edit Mode

Errors During Script Execution

Run Mode

Stopped Mode

GS Scripter Overview

Macro Script Overview

Opening a Script File

Running a Script

Saving Script Files

What are Macro Script Files?


Stopped Mode

Stopped mode is entered by choosing Break while in the run mode, or between steps during the trace mode.  On the Run menu the Start (or Break) command is replaced with Continue.  The Continue command causes script execution to resume from where it was stopped.  The Restart command is essentially the same as the Start command.  The only difference is that the GS Scripter's intermediate code is still in memory, so execution will begin faster than with the Start command.  The End command terminates the execution of the script, and returns you to the edit mode.  In contrast to run mode, stopped mode allows you to restart the script from the beginning, or continue the script from the place it was stopped.  Typing text in the GS Scripter Edit window while a script is stopped causes the program to revert to Edit mode.

See Also

Edit Mode

Errors During Script Execution

Run Mode

Trace Mode

GS Scripter Overview

Macro Script Overview

Opening a Script File

Running a Script

Saving Script Files

What are Macro Script Files?


Errors During Script Execution

When an error is encountered during script execution, the script is halted and an error dialog box is displayed that indicates the type of error.  Also, the line in the script is highlighted so you can easily locate the error.  When you encounter an error, click the Help button in the error dialog box for more information on the error and how to fix the problem.

See Also

Edit Mode

Run Mode

Stopped Mode

Trace Mode

GS Scripter Overview

Macro Script Overview

Opening a Script File

Running a Script

Saving Script Files

What are Macro Script Files?


Rules for Statements, Functions and Commands

Statements, functions and commands are typically entered one to a line.

PRINT "Procedure Completed"

When you want to enter two or more of these items on the same line you can use a colon between statements or functions.  For example:

a = 5 : b = 5 * a : PRINT b

The language is case-insensitive.  Using

print "Procedure Completed"

is the same as using

PRINT "Procedure Completed".

The maximum length of a line is 255 characters, but statements can be continued over several lines by placing a backslash on the end of a line with an incomplete statement:

object.DrawRectangle(Left=1.0, Top=4.4, Right=3.5,\

Bottom=3.4, ID=Rectangle)

Strings, however, cannot span more than one line.  This is illegal:

a$ = "Text strings cannot span\

over more than one line."

The single quote character is used to enter comments.  All characters on the line after a single quote character are ignored.  This allows you to add remarks to your script.  For example:

object.FileClose(Save=2)   Close the current doc window and do not save the drawing

In addition, you can use the REM statement to add a remark in the script.  However, REM statements can only be used at the beginning of a line.

See Also

Arrays

Functions and Statements - Alphabetic List

Labels

Operators

Reserved Words

Using Functions

Variables


Variables

The language supports four types of variables: reals, integers, strings, and objects:

*	Real variables represent real numbers whose absolute values are between 2.2e-308 and 1.7e+308. Real variables are accurate to a maximum of 15 significant digits (although cumulative errors during computations will usually reduce this accuracy).

*	Integer variables represent whole numbers between -2.1e+9 and 2.1e+9.  A fractional number will be rounded to the nearest whole number when it is assigned to an integer variable.

*	String variables represent text.  String variables can store any amount of text.

*	Object variables refer to programmable objects.  Programmable objects contain functions and possibly other data that the script can access through the object variable.  Before these functions can be accessed an object must be created using the CreateObject function (described below).

Objects are supplied by external programs.  The objects must be properly registered with Windows before they can be created by the script processor.  Consult the documentation for programs that make objects available for the names of the functions they supply.

Variable names can be up to 32 characters long.   They can contain letters or numbers, but the first character must be a letter or an underscore.  The language is case insensitive so names like "YellowTail", "yellowtail" and "yellowTAIL" are one and the same.  Variables cannot have the same name as any of the reserved words or built-in.

The last character in a variable signifies its type.  If the variable ends with a "#" or a "!" it is a real variable; if it ends with a "%" it is an integer variable; if it ends with a "$" it is a string variable.  Variables that do not end with one of these characters will automatically be real variables.  (The DIM statement, however, can be used to declare any variable name to any of the four types.  See the section on DIM .)

See Also

Arrays

Functions and Statements - Alphabetic List

Labels

Operators

Reserved Words

Rules for Statements, Functions and Commands

Using Functions


Arrays

Array variables with up to 12 dimensions may be used.  With one exception, all arrays must be dimensioned with a DIM statement.  One-dimensional arrays whose dimension is less than or equal to 10 do not need to be declared in a DIM statement.

Arrays elements are accessed with the variable name followed immediately by a left parenthesis, a list of array subscripts - one for each dimension - separated by commas, and a right parenthesis.  For example:

*	Example of accessing a one-dimensional array:

a(5) = 100

*	Example of declaring and accessing a two-dimensional array:

DIM b(10,10) AS REAL

b(1+3,4*2) = 50

PRINT b(0,0)

Array subscripts begin with zero:

DIM c(2) AS REAL

c(0) = 2 : 	c(1) = 4 : 	c(2) = 6

Notice that in this case an array whose maximum subscript value is 2 actually has room for three elements because the array subscripts start with 0.

Arrays of object variables are supported:

DIM Obj(5) AS OBJECT

For i = 1 to 5

SET Obj(i) = CreateObject(Sample.Application)

Next

Two sets of parentheses are used to call the default method of an member of an array of objects:

DIM Obj(5) AS OBJECT

SET Obj(1) = CreateObject(Sample.Application)

Result = Obj(1)(arg1=1,arg2=4)

The first set of parentheses specify array element 1, and the second set of parentheses contain the argument list for the objects default method

See Also

Functions and Statements - Alphabetic List

Labels

Operators

Reserved Words

Rules for Statements, Functions and Commands

Using Functions

Variables


Labels

A label is used to mark a location in a script for a GOTO or a GOSUB statement.  A label must be the first statement on a line (it does not need to start in the first column, however) and it must

be followed by a colon:

     labelname:

See Also

Arrays

Functions and Statements - Alphabetic List

Operators

Reserved Words

Rules for Statements, Functions and Commands

Using Functions

Variables


Using Functions

The scripting language supplies several useful mathematical and string manipulation functions.  Objects supplied to the script by other programs may also contain functions that can be called.

To use a function you type the function name and an argument list in parentheses:

     a$ = left$("Mount Everest", 5)

Individual arguments within the argument list are separated by commas.

Functions contained in objects are accessed by typing the object name, a period, the function name and then the argument list in parentheses:

          Object.FunctionA ( 1, 2 * 5, 3 )

The functions provided by the scripting language all require a set number of arguments and these arguments must be supplied in the correct order.  Functions provided by objects, however, may not require you to enter all of their possible arguments (see the documentation for the program supplying the object for details of required and optional parameters).

There are two ways to skip optional arguments.  The first way is to enter two commas in a row:

      Object.FunctionA( argument1,argument2,,argument4)

any number of arguments may be skipped in this way:

     Object.Function(,argument2,,)

The second way to skip optional arguments is to used named arguments.  Objects supply names for their arguments and these names may be used in the argument list:

     Object.FuncA(ARGUMENT7 = value)

In this case we assume that "ARGUMENT7" is the name of an argument used by the function FuncA.

See Also

Arrays

Functions and Statements - Alphabetic List

Labels

Operators

Reserved Words

Rules for Statements, Functions and Commands

Variables


Operators

The language supports the following arithmetic and logical operators:

-    unary negation	(1)

*    multiplication	(2)

/    division	(2)

MOD  modulo division	(3)

+    addition or string concatenation	(4)

-    subtraction                        	(4)

>    is greater than                    	(5)

<    is less than                       	(5)

>=   is greater than or equal to        	(5)

<=   is less than or equal to           	(5)

=    is equal to                        	(5)

<>   is not equal to                    	(5)

NOT  logical not / bitwise negation     	(6)

AND  logical and / bitwise and          	(7)

OR   logical or  / bitwise or           	(8)

XOR  bitwise exclusive or               	(9)

The numbers on the right refer to the precedence level of the operator.  Operations with a higher precedence are always carried out before operations of a lower precedence.  Expressions are evaluated from left to right.  Parentheses may be used to override the precedence levels.

See Also

Arrays

Functions and Statements - Alphabetic List

Labels

Reserved Words

Rules for Statements, Functions and Commands

Using Functions

Variables


Object Property Values

The values of object properties can be retrieved and set using the method shown here.

SET XL = CreateObject(Excel.Application)

XL.Visible = 1

PRINT XL.Name

Flavor$ = XL.InputBox$(prompt=Enter a Flavor,default=Vanilla)

Print Flavor$

XL.Quit()


REM statement

The REM statement is used for entering remarks in a script.  All the characters following the REM statement up to the next end of statement marker (a colon or the end of the line) are ignored.

Examples:

     REM This is a comment : PRINT "This statement should print"

     GOTO top_of_loop  :  REM  Go back to the top of the loop

The single quote character ' may also be used to enter comments.  All characters on the line after a single quote character are ignored.

See Also

Functions and Statements - Alphabetic List


GOTO Statement

GOTO is used to unconditionally send program execution to a new line.  It has the following syntax:

GOTO labelname:

where labelname is the name of a label that must appear somewhere in the script.  A label must be the first statement on a line (it does not need to start in the first column, however) and it must

be followed by a colon:

labelname:

See Also

Functions and Statements - Alphabetic List


GOSUB and RETURN statements

GOSUB is used to branch to a subroutine and RETURN is used to return from the subroutine.  The statements have the following syntax:

GOSUB Message

end

Message:

print Whats up?

RETURN

RETURN

The GOSUB statement sends the program execution to the location of the label and the RETURN statement send program execution back to the last-executed GOSUB.

See Also

Functions and Statements - Alphabetic List


OPTION EXPLICIT Statement

The OPTION EXPLICIT statement is used to prevent accidental mis-typing of variable names.  After the OPTION EXPLICIT statement has been executed, new variables cannot be used unless they have appeared in a DIM statement.

Example:

OPTION EXPLICIT

DIM Result AS REAL

Reslt = 100      <---- 	Error, the variable "Reslt" was not declared in a DIM statement

See Also

Functions and Statements - Alphabetic List


DIM ... AS Statement

The DIM statement is used to dimension array variables, to assign variables different types from their default type, and to declare variable names when the OPTION EXPLICIT statement has been used.

To dimension array variables the DIM statement is used as follows:

DIM VarName(array dimensions) AS variable type

where variable type is INTEGER, REAL, or STRING and array dimensions is a list of array dimensions.

Examples:

*	A one-dimensional array of strings:

DIM Strings(500) as STRING

*	A two-dimensional array of integers:

DIM Coordinates(100,100) AS INTEGER

*	A five-dimensional array of reals:

DIM TimeWarp(10,20,30,50,10) AS REAL

*	Several variables dimensioned in one DIM statement

DIM Temperatures(50) AS REAL, Observations(50) AS STRING

To declare variables for the OPTION EXPLICIT statement or to assign them different types from their default types the array dimensions may be omitted:

     DIM Name AS STRING

     DIM cat AS REAL, dog AS INTEGER, mouse AS INTEGER

     DIM sky AS REAL

     DIM tiger AS OBJECT

The REAL, INTEGER, STRING and OBJECT key words are used to declare the variable types.  Arrays of OBJECT variables cannot be used.

See Also

Functions and Statements - Alphabetic List


SET Statement

The set statement is used to assign an object to an object variable.  It must be used as follows:

     SET  ObjectVariable = CreateObject("Object Name")

where ObjectVariable represents a variable name and "Object Name" represents the name of an object supplied by another program (the object name must appear in quotes).

     Examples:

     SET SurferObj = CreateObject("Surfer.App")

     SET ExcelWorksheet = CreateObject("Excel.Worksheet")

If the CreateObject function succeeds in creating the object referred to by "Object Name" the object variable will contain all the functions made available by that object.

Functions in an object are accessed with the object name followed by a period and the function name:

     SurferObj.DrawMarker( 2, 2 )

     ExcelWorksheet.SetCell("A5", 25.5)

Consult the documentation for programs that supply objects for the names of the functions their objects contain.

See Also

Functions and Statements - Alphabetic List


IF ... THEN ... ELSE Statement

The IF ... THEN ... ELSE statement is used to test a condition and perform different operations depending on the result of the test.

     Examples:

     IF "Boston" > "New York" THEN BEEP()

     IF apples = oranges THEN

          PRINT "Halleluja!"

     ELSE

          BEEP() : BEEP()

     ENDIF

     IF Answer$ = "No" THEN

          Meadow = 1

          Daisy = 2

          Result$ = "No way"

     ENDIF

See Also

Functions and Statements - Alphabetic List


WHILE...WEND Statement

The WHILE...WEND statement is used to execute a block of statements while a condition is true.

     Example:

     WHILE a < b AND grass$ = "green"

          a = a + 1

          b = b * 2

     WEND

See Also

Functions and Statements - Alphabetic List


FOR...NEXT Statement

The FOR...NEXT statement is used to execute a block of statements a certain number of times.

     Examples:

          FOR i = 1 TO 5

               PRINT i

          NEXT

          FOR b = 100 TO 50 * x STEP 4

               Sum = Sum + b

               Count = Count + 1

          NEXT

          FOR Days = 31 TO 1 STEP -1

               Hours = Hours - 24

               Day$  = STR$(Days)

               show$ = "Day number:" + Day$

               PRINT  show$

               PRINT  "Hours remaining =" Hours

          NEXT

See Also

Functions and Statements - Alphabetic List


EXIT Statement

The exit statement is used to break out of a WHILE...WEND or FOR...NEXT statement from the middle of the loop.

     Examples:

          WHILE 1 < 2

               x = x + 100

               if x > 1.5e32 THEN EXIT

               y = y - x

          WEND

          FOR a = 0 TO -500000 STEP -.0001

               PRINT a

               x = x * a

               IF ABS(x) > 5e6 THEN

                    PRINT x

               ELSE

                    EXIT

               ENDIF

          NEXT

When the EXIT statement is executed execution will continue at the end of the loop.  Do not confuse the EXIT statement with the END statement.

See Also

Functions and Statements - Alphabetic List


END Statement

The END statement is used to terminate script execution:

     IF Result = ReallyBadError THEN END

See Also

Functions and Statements - Alphabetic List


STOP Statement

The STOP statement is used to pause a script.  It has the same effect as pressing the Ctrl-Break key or selecting the Run,Break command.

The STOP statement is useful for debugging and testing scripts.

See Also

Functions and Statements - Alphabetic List


Reserved Words

These words are a part of the language and cannot be used for variable names or goto labels:

   AND

   APPEND

   AS

   DIM

   ELSE

   END

   ENDIF

   EXIT

   EXPLICIT

   FOR

   GOSUB

   GOTO

   IF

   INPUT

   INTEGER

   LINE

   NEXT

   NOT

   OBJECT

   OPTION

   OR

   OUTPUT

   REAL

   REM

   RETURN

   SET

   STEP

   STOP

   STRING

   THEN

   TO

   WEND

   WHILE

   XOR

The names of built-in functions and statements are also reserved and cannot be used for variable or label names.


Functions and Statements - Alphabetic List

The language supplies several mathematical and string manipulation functions:

Miscellaneous Statements

DIM ... AS Statement

END Statement

EXIT Statement

FOR...NEXT Statement

GOSUB and RETURN Statements

GOTO Statement

IF ... THEN ... ELSE Statement

OPTION EXPLICIT Statement

REM Statement

SET Statement

STOP Statement

WHILE...WEND Statement

Math Functions

ABS

ATN

COS

EXP

LOG

SIN

SQR

TAN

String Functions

LCASE$

LEFT$

LEN

LTRIM$

MID$

RIGHT$

RTRIM$

STR$

TRIM$

UCASE$

VAL

Type Conversion Functions

ASC

CHR$

CINT

FIX

INT

STR$

VAL

Directory Functions/Statements

CHDIR

CURDIR$

CHDRIVE

DIR$

KILL

MKDIR

NAME

RMDIR

Miscellaneous Functions/Statements

BEEP

CLS

CREATEOBJECT

DATE$

DIM ... AS

END

EXIT

FOR...NEXT

GOSUB and RETURN

GOTO

IF...THEN...ELSE

INPUTBOX$

LCASE$

LTRIM$

MSGBOX

OPTION EXPLICIT

PRINT

RANDOMIZE

REM

RND

RTRIM$

SET

SGN

SHELL

SLEEP

STOP

TERMINATE

TIME$

TRIM$

UCASE$

WHILE...WEND

File Handling Functions/Statements

CLOSE

EOF

LINE_INPUT#

OPEN

PRINT#

WRITE#


ABS

Computes the absolute value of a numeric argument:

RealVar = ABS(x)

See Also

Functions and Statements - Alphabetic List


ASC

Converts the first character of a string to its ANSI character code.

IntVar = ASC(StringVar)

See Also

Functions and Statements - Alphabetic List


ATN

Computes the arc-tangent, in radians, of an argument:

RealVar = ATN(x)

The returned angle is between -pi/2 and pi/2

See Also

Functions and Statements - Alphabetic List


BEEP

Emits a beep:      BEEP()

See Also

Functions and Statements - Alphabetic List


CHDIR

Changes the current directory to the specified directory.   The current drive is unchanged.

ChDir(path$)

See Also

Functions and Statements - Alphabetic List


CHDRIVE

Changes the current drive to the specified drive

ChDrive(drive$)

The first character of the drive string is used to specify the drive ("A", "B", "C", etc.)

See Also

Functions and Statements - Alphabetic List


CHR$

Converts an ANSI character code to a one-character string.  ANSI characters must be between 0 and 255, inclusive.

StringVar = CHR$(code)

See Also

Functions and Statements - Alphabetic List


CINT

Rounds a number to the nearest integer.  CInt always rounds to the nearest  even number when the fractional part is 0.5.  For example, 4.5 rounds to 4,  and 5.5 rounds to 6.  IEEE has made this scheme a standard to keep rounding  from introducing bias into data sets.

IntVar = CINT(x)

CINT(100.43) equals 100

CINT(-1.9) equals -2

See Also

Functions and Statements - Alphabetic List


CLS

Clears the output window

 CLS()

See Also

Functions and Statements - Alphabetic List


CLOSE

Syntax:

CLOSE	Close all open files

CLOSE #file number [, # file number] 	Close the specified file(s)

The CLOSE statement closes an open file.  All files that are opened with the OPEN statement should be closed to insure that all data are written to the file.

Example:

OPEN c:\test FOR APPEND AS #1

OPEN c:\data FOR INPUT AS #2

...

CLOSE #1, #2

See Also

Functions and Statements - Alphabetic List


COS

Computes the cosine of an angle in radians:

RealVar = COS(x)

See Also

Functions and Statements - Alphabetic List


CreateObject

See the SET statement for a description of this function.

See Also

Functions and Statements - Alphabetic List


CURDIR$

Returns the current directory on the current drive.

directory$ = CurDir$()

See Also

Functions and Statements - Alphabetic List


DATE$

Returns a string containing the current date in the form mm/dd/yy where mm represents the month, dd the day and yy the year.

StringVar = DATE$()

See Also

Functions and Statements - Alphabetic List


DIR$

Retrieves a list of files and directories on a disk.  The function should be called the first time as follows:

File$ = Dir$(Wildcard$,Attr%)

where Wildcard$ is a the path and file specification of the files to retrieve and Attr% is an optional argument specifying the attributes of the files to retrieve.  Attr% must be the sum of one or more of the following values:

    0  List only normal files.

    2  List normal and hidden files.

    4  List normal and system files.

    8  List only the volume name.

    16 List subdirectory names and normal files.

If Attr% is omitted only normal files are listed.

The function returns a filename matching the specified wildcard string or a blank string if no files match the wildcard.  To retrieve additional files that match the same wildcard string and that have the same attributes the function should be called as follows:

File$ = Dir$()

The function will continue to return a different file which matches the wildcard string until all matching files have been retrieved.  When all files have been retrieved the function return a blank string.  After the function returns a blankl string it must be called with a new wildcard string or else an error will occur.

Example:

    'List all the files and directories in the c:\gs directory

     a$ = Dir$("c:\gs\*.*",16)

     Print a$

     While (a$ <> "")

        a$ = Dir$()

        Print a$

     Wend

See Also

Functions and Statements - Alphabetic List


EOF

Syntax:

EOF(filenumber)

Returns -1 if the specified file is at its end or 0 if it isnt

Example:

OPEN filename for INPUT AS #1

WHILE EOF(1) = 0

   LINE INPUT #1, A$

   PRINT A$

WEND

CLOSE

See Also

Functions and Statements - Alphabetic List


EXP

Computes e raised to a power:

RealVar = EXP(x)

See Also

Functions and Statements - Alphabetic List


FIX

Truncates the fractional part of a number.  Returns the whole part.

IntVar = FIX(x)

Examples:

fix(1.5) equals 1

fix(-1.25) equals -1

See Also

Functions and Statements - Alphabetic List


INPUTBOX$

Displays a dialog box that allows text to be input and returns the text entered in the dialog box.  If no text is entered in the dialog box or if the cancel button is pressed a blank string is returned.

The INPUTBOX$ function takes three arguments, any or all of which may be omitted.  The first argument is a string to display as a prompt in the dialog box.  The second argument is the caption to display in the title bar of the dialog box.  The third argument is the default response string to display in the dialog box.

StringVar = INPUTBOX$(Prompt$,Caption$,Default$)

StringVar = INPUTBOX$()

StringVar = INPUTBOX$(,Caption$)

StringVar = INPUTBOX$(,Caption$,Default$)

See Also

Functions and Statements - Alphabetic List


INT

Returns the nearest integer less than the number specified

     INT(5.9) = 5        INT(-5.9) = -6

IntVar = INT(x)

See Also

Functions and Statements - Alphabetic List


LCASE$

Converts any upper case letters to lower case and returns a copy of the converted string.  The original string is not affected.

Example:

print lcase$(AbCdEf)

Result:

abcdef

See Also

Functions and Statements - Alphabetic List


LEFT$

Returns the left-most n characters in a string:

StringVar = LEFT$(str,n)

See Also

Functions and Statements - Alphabetic List


LEN

Finds the length of a string:

IntVar = LEN(str)

See Also

Functions and Statements - Alphabetic List


LOG

Computes the natural logarithm of a number:

RealVar = LOG(x)

See Also

Functions and Statements - Alphabetic List


LTRIM$

Removes spaces and tab characters from the left side of a string.

Example:

print *  ltrim$(     Text     )  *

Result:

*Text     *

See Also

Functions and Statements - Alphabetic List


KILL

Deletes a file on a disk (like the DOS Del and Erase commands)

KILL(FileName$)

The file name string cannot include wild card characters.

See Also

Functions and Statements - Alphabetic List


LINE_INPUT#

Reads a line from the specified file.

Syntax:

LINE INPUT # file number, string variable

file number:  The number used in the OPEN statement to open a file.

string variable: The name of a string variable to receive the line read from the file.

Example:

OPEN c:\test FOR INPUT AS #1

LINE INPUT #1, a$

See Also

Functions and Statements - Alphabetic List


MID$

Extracts a sub-string of length n starting at the p-th position of a given string:

SubString = MID$(StringVar,p,n)

See Also

Functions and Statements - Alphabetic List


MKDIR

Creates a new directory (like the DOS MkDir commnad).

MKDIR(Directory$)

See Also

Functions and Statements - Alphabetic List


MSGBOX

Displays a message box

stat% = MsgBox(message$,style%,caption$)

The style code and caption string are optional.  The style code must be the sum of three codes:

  Button codes:

         0  OK button

         1  OK and Cancel buttons

         2  Abort/Retry/Ignore buttons

         3  Yes/No/Cancel buttons

         4  Yes and No buttons

         5  Retry and Cancel buttons

  Icon codes:

         0  No icon

        16  Stop sign icon

        32  Question mark icon

        48  Exclamation mark icon

        64  Information symbol icon

  Default button codes (the button that is selected when the enter key

  is pressed):

         0  First button is the default

       256  Second button is the default

       512  Third button is the default

If the style code is omitted it defaults to 0.  If an invalid code is

specified the style will revert to the default style.

The function returns a code indicating which button was pressed.  The possible return values are:

        0   Unable to display message box

        1   OK

        2   Cancel

        3   Abort

        4   Retry

        5   Ignore

        6   Yes

        7   No

See Also

Functions and Statements - Alphabetic List


NAME

Renames a file on the disk (like the DOS Ren command).  The file cannot be moved from one directory to another by this statement.

NAME OldFile$ AS NewFile$

Example:

NAME "c:\file1.txt" AS "c:\data1.dat"

See Also

Functions and Statements - Alphabetic List


OPEN

Opens a file so that data can be read from it or written to it.

Syntax:

OPEN file name FOR file mode AS [#] file number

Where:

file name is a string indicating the name of the file to open.  The complete path of the file (drive and directories) should be specified

file mode is one of the following: INPUT, OUTPUT, or APPEND.

INPUT opens the specified file so that data can be read from it.

OUTPUT opens the file so that data can be written to it.   If the specified file does not exist it will be created.  WARNING: If the specified file already exists it will be truncated to zero length.

APPEND opens the specified file so that data can be written at the end of the file.

file number is a number from 1 to 10.  Every open file must be given a unique file number.  Note that the pound sign (#) preceeding the file number is optional.

Examples:

OPEN c:\file FOR INPUT AS #1

a$ = c:\test

OPEN a$ FOR OUTPUT AS 7

See Also

Functions and Statements - Alphabetic List


PRINT

The print statement is used to display information in the program's output window:

     Example:

     PRINT  variable  number "string constant",,number;variable;

Any number of items may be printed in a single PRINT statement.   The items must be separated with one or more spaces, tabs or semicolons or with a comma.

Commas advance the print cursor to the next tab stop.

A semicolon at the end of a print statement will suppress the line feed normally generated by PRINT.  This means that the output of the next print statement will appear on the same line instead appearing on a line of its own.

See Also

Functions and Statements - Alphabetic List


PRINT#

Syntax:

PRINT # file number,  Expression list

PRINT # works like the PRINT statement except it sends the ouput to a file instead of the output window.

Example

OPEN c:\test FOR OUTPUT AS #5

PRINT #5,  10+10, This is a test.

CLOSE #5

Note that the comma following the file number is required.  Commas and semicolons have the same effect in the PRINT # statement as they do in the PRINT statement.

The specified file must have been opened in OUTPUT or APPEND mode.

See Also

Functions and Statements - Alphabetic List


RANDOMIZE

Re-seeds the random number generator.

RANDOMIZE(x)

x is optional.  If omitted the current clock count will be used as the seed.

See Also

Functions and Statements - Alphabetic List


RIGHT$

Returns the right-most n characters in a string:

StringVar = RIGHT$(str,n)

See Also

Functions and Statements - Alphabetic List


RMDIR

Deletes a directory from the disk (like the DOS RmDir command).  The directory cannot contain any files or directories.

RMDIR(Directory$)

See Also

Functions and Statements - Alphabetic List


RND

Generates a pseudo-random number between 0 and 1, inclusive

RealVar = RND()

See Also

Functions and Statements - Alphabetic List


RTRIM$

Removes spaces and tab characters from the right side of a string.

Example:

print *  rtrim$(     Text     )  *

Result:

*     Text*

See Also

Functions and Statements - Alphabetic List


SGN

Returns -1, if the argument is less than 0, 0 if the argument is equal to  zero, or 1 is the argument is greater than zero.

IntVar = SGN(x)

See Also

Functions and Statements - Alphabetic List


SHELL

Executes another program.  The executed program will run concurrently with the script.

result% = Shell(cmdline$,style%)

The style argument is optional.  If it is specified it must be one of the following:

   1   Activate the window at its normal size

   2   Activate the window and show it as an icon

   3   Activate the window and show it maximized

   4   Show the window at normal size, don't activate

If the window style is omitted the default style is 2.  The window style of DOS programs is determined by their .PIF file.

The function returns the instance identifier of the executed  program.  If the program cannot be run an error message is displayed and the function returns 0.

See Also

Functions and Statements - Alphabetic List


SIN

Computes the sine of an angle in radians:

RealVar = SIN(x)

See Also

Functions and Statements - Alphabetic List


SLEEP

Pauses for a given number of seconds or until a key is pressed.

Sleep(nSeconds)

The duration argument is optional.  If it is omitted execution pauses until a key is pressed.

See Also

Functions and Statements - Alphabetic List


SQR

Computes the square root of a number:

RealVar = SQR(x)

See Also

Functions and Statements - Alphabetic List


STR$

Converts a numeric value to a string.  Positive numbers always contain a leading space.  This space can be removed with the LTRIM$() function.  The Val function is the opposite in that it accepts a number and returns it as a string.

StringVar = STR$(x)

See Also

Functions and Statements - Alphabetic List


TAN

Computes the tangent of an angle in radians:

RealVar = TAN(x)

See Also

Functions and Statements - Alphabetic List


TERMINATE

Exits the scripter program.  This has the same effect as choosing File, Exit

Terminate()

See Also

Functions and Statements - Alphabetic List


TIME$

Returns a string contain the current clock time in the form

hh:mm:ss

where hh represents the hour between 0 and 23

mm represents the minute and ss represents the second.

StringVar = TIME$()

See Also

Functions and Statements - Alphabetic List


TRIM$

Removes spaces and tab characters from the left and right sides of a string.

Example:

print *  ltrim$(     Text     )  *

Result:

*Text*

See Also

Functions and Statements - Alphabetic List


UCASE$

Converts any lower case letters to upper case and returns a copy of the converted string.  The original string is not affected.

Example:

print UCASE$(AbCdEf)

Result:

ABCDEF

See Also

Functions and Statements - Alphabetic List


VAL

Converts a string to a number:

RealVar = VAL(str)

See Also

See Also

Functions and Statements - Alphabetic List


WRITE#

Writes a list of values to a file.  String values are enclosed in quotes when they are written, and all values are separated by commas.  This function is similar to the PRINT # statement except that it automatically prints commas between items in the expression list and it automatically encloses strings in quotes.

The file identified by filenumber must be opened in Output or Append mode.  Unlike the Print # statement, the Write # statement inserts commas between items and quotation marks around strings as they are written to the file.  You don't have to put explicit delimiters in the list.  Write # inserts a newline character after it has written the final character in the expression list.

Syntax:

WRITE # file number, Expression list

Example:

OPEN c:\test FOR OUTPUT AS #2

WRITE #2, a$, b$, a + b

CLOSE

See Also

Functions and Statements - Alphabetic List


"Internal Error"

The program has detected an internal inconsistency.  This message indicates a problem (bug) in the program.


"Out of memory"

The program has been denied the use of memory it requested.  Closing other applications may free the memory needed by the program.


"Unable to create window"

There is insufficient memory or system resources to create a required window.  To check the available resources select the Help-About command from the Program Manager.  Close all unused documents and applications (such as Help) and try the operation again.


"Unable"

The specified file could not be found.  Either the file is not present, in the wrong directory or disk was specified, or you have made a simple spelling error.  Be sure to check where the program is looking for the file.  Often the program is just looking in the wrong directory.


"Unable to read ..."

The program cannot read information from the file.  The file may be corrupted or in an invalid format.


"Unable to write ..."

An error occurred while writing the specified file.  This is usually caused by a full disk.  Try specifying a different disk or remove unneeded files from the disk and try again.


"Unable to find ..."

The specified file could not be located.  Make sure the correct drive, path and filename were specified and try again.


"Unable to load ..."

The specified DLL could not be loaded.  This may happen if the DLL is corrupt, there is insufficient memory or system resources, or the DLL could not be found.


"Unable to initialize ..."

   Unable to initialize the specified DLL.


"Unable to install signal handler"

The program cannot install a floating-point error handler.  Errors with mathematical processing will be handled by the  system.


"Floating point error: ..."

Floating-point number processing created a problem.  Division by zero, overflow and loss of precision are some of the possible problems.  This message indicates a flaw in the program.


"Incompatible version of ..."

The specified file is not compatible with the current version  of GS Scripter.


"Common dialog error ..."

This message indicates an internal error in one of the common dialog boxes (File Open, File Save As) supplied by Windows.


"Unable to load string"

A string resource could not be loaded from the disk.  This  message indicates an error in the program or a critical shortage of available memory.


"The '... =' entry in the INI file is invalid"

A line in the .INI file is not valid.  Placing a semicolon ';'  in front of the specified line will prevent this error message from occurring.

Invalid entries in the [Help Items] section of GSMAC.INI will  generate this error.  The error occurs when the format of the  entry is incorrect or when the specified help file cannot be found (in which case this message will be preceded by a "File not found" message).  (Unless the help file is moved out of the GS search path or the user edits the INI entries this error should not occur.)


"Invalid run command"

The name of the file to run was not provided after a /x switch on the command line.


"Invalid command-line switch"

An unknown switch (i.e., a slash, /, followed by a letter) was used on the command line.


"File ... is too big to edit"

The editor window cannot hold a file as large as the one being opened.


"The maximum file size has been reached"

The editor window is full and cannot hold any more text.


"Illegal value, argument number ..."

The specified argument is invalid.


"Overflow"

The maximum or minimum value of a variable has been exceeded.  For real variable the largest magnitude is +/- 1.798e+308.  For integer variables the largest magnitude is +/- 2,147,483,647


"Unable to run '...'"

The program specified in the SHELL function could not be found, the specified program has an invalid format, or some error occurred in loading the program.


"Unable to create timer"

The system has run out of timer resources.  Close other programs (such as Clock) which may be using timers.


"Illegal function call"

A function has been called inappropriately.  For example, this error occurs when DIR$ is called without a new file name template after it has returned all the files names matching a previous filename template.


Interpreter DLL Error messages

------------------------------


"Internal error"

The DLL has detected an internal inconsistency.  This message indicates a problem (bug) in the DLL.


"Out of memory"

The DLL has been denied the use of memory it requested.  Closing other applications may free the memory needed by the program.


"EXPLICIT without OPTION"

The EXPLICIT keyword was used outside an OPTION statement.


"ENDIF without block IF"

The ENDIF keyword was used out of context.  Every ENDIF must have a corresponding block IF.  A "block" IF is an IF statement in which the statements following the THEN appear on a different line from the IF ... THEN statement.

   Examples:

      single-line IF:

            IF a < b THEN BEEP()

      multiple-line or block IF:

            IF a < b THEN

               BEEP()

            ENDIF


"WEND without WHILE"

The WEND keyword was used without a corresponding WHILE statement.


"NEXT without FOR"

The NEXT keyword was used without a corresponding FOR statement.


"RETURN without GOSUB"

The RETURN keyword was encountered without a GOSUB statement having previously been executed.


"Block IF without ENDIF"

A multi-line IF statement is missing its corresponding ENDIF statement.


"WHILE without WEND"

A WEND statement is missing its corresponding WEND statement.


"FOR without NEXT"

A FOR statement is missing its corresponding NEXT statement.


"Missing EXPLICIT"

An OPTION statement is missing the EXPLICIT keyword.


"Missing THEN"

An IF statement is missing the THEN keyword after its test expression:

         IF test THEN ...


"Missing TO"

A FOR statement is missing the TO keyword between its start and end expressions:

         FOR variable = start TO end [STEP step_value]

         ...

         NEXT


"Missing AS"

A DIM statement is missing the AS keyword after a variable name:

      DIM variable AS type


"Missing FOR"

An OPEN statement is missing the FOR keyword before the file mode:

      OPEN "filename" FOR INPUT AS #1


"Missing 'INPUT'"

The INPUT keyword is missing from the LINE INPUT statement:

      LINE INPUT #1, a$


"Missing INPUT, OUTPUT, or APPEND"

The file read/write mode is missing from an open statement:

      OPEN "filename" FOR APPEND AS #2


"Missing comma after the file number"

The comma following a file number is missing.

      WRITE #1 a$    ' error

      WRITE #1, a$   ' correct


"Expected ')'"

The specified symbol is missing.


"Expected '('"

The specified symbol is missing.


"Expected closing quote"

The specified symbol is missing.


"Expected '='"

The specified symbol is missing.


"Expected '.'"

The specified symbol is missing.


"Expected end of statement"

The specified symbol is missing.


"Expected a variable"

The specified symbol is missing.


"Expected a label"

The specified symbol is missing.


"Expected an object variable"

The specified symbol is missing.


"Expected ','"

The specified symbol is missing.


"Expected '#'"

   The specified symbol is missing.


"Expected a member function name"
"Expected a method or property name"

An object name and period are specified, but the name of a member function is missing:

      DIM Obj AS OBJECT

      SET Obj = CreateObject("ObjName")

      Obj.

In the last line, the name of one of the object's member functions is missing.


"Expected a type identifier"

The type identifier is missing from a DIM statement.  The type identifiers are INTEGER, REAL, STRING and OBJECT.


"Duplicate definition"

A variable or a label has already been defined.  Variables are defined in DIM statements or when they are first used.  Re-defining the variable in a DIM statement will cause this error.

The error is also caused when a label appears in more than one place or when an object variable appears in more than one SET statement.


"Undefined label"

The specified label is not defined anywhere in the script.


"Object reference without SET"
"Object variable not set"

This error can also be caused by omitting the SET keyword assigning the value of one object variable to another:

Example:

     SET Surf = CreateObject("Surfer.App")

     Surf2 = Surf  ' <-- error, should be:  SET Surf2 = Surf

An object has not been created for the object variable.  An object must be created with the

     SET object_variable = CreateObject("object name")

statement before the object variable can be used.


"Undeclared array"

The variable has not been dimensioned in a DIM statement.  Arrays with more than one dimension or with more that 10 elements must be dimensioned in a DIM statement before they can be used.


"Undeclared variable"

The variable was not declared in a DIM statement.   After the OPTION EXPLICIT statement has been executed all variables must be declared in a DIM statement before they can be used.


"Unexpected end of file"

The script file ended unexpectedly.


"Unexpected end of line"

The line ended before a statement was completed.


"Illegal character"

An invalid character was found in the script.


"Syntax error: '...'"

A statement has invalid syntax.  The specified word or letter was unexpected.


"Syntax error: ...'"

A statement has invalid syntax.  The specified word or letter was unexpected.


"Line too long"

The maximum line length of 256 characters was exceeded.


"Subscript out of range"

An array subscript value is larger than the array size specified in a DIM statement or it is less than zero.


"Maximum array dimension (...) exceeded"

An attempt was made to dimension a variable with more than the maximum number of array dimensions.


"Wrong number of dimensions"

The number of subscripts in the array reference differs from the number of dimensions specified in a previous DIM statement.

If the array did not appear in a DIM statement it is a one-dimensional array.


"Maximum GOSUB nesting (... levels) exceeded"

Too many GOSUB statements have been executed without the corresponding RETURN having been executed.


"Maximum loop nesting (... levels) exceeded"

Too many FOR or WHILE loops have been nested inside other loops.


"Type mismatch"

In an assignment statement, the type on the right side of the equals sign does not match the type of the variable on the left side of the equals sign.

In an expression, one of the terms is not appropriate for the operation being performed.  For example, multiplying a number and a string is a type mismatch error.


"Expression too complex"

Too many nested parentheses were used in an expression.  Break the expression into two or more parts and use temporary variables to store intermediate results.


"Division by zero"

An attempt was made to divide by zero.


"Overflow"

An attempt was made to set a variable equal to a value whose magnitude exceeds the variable's maximum range or the result of a calculation was too large for capacity of the computer representation.


"Exit out of context"

An EXIT statement is used outside of a FOR ... NEXT or WHILE ... WEND loop.


"Invalid assignment"

A expression that does not evaluate to a number or string appears on the right side of an equals sign.


"Unknown member: %s"

An attempt was made to call an unknown object method or property.


"Illegal argument value"

The value passed to a function was not valid.  For example, passing a negative number to the LOG function causes this error.


"Illegal exponentiation"

An attempt was made to do one of the following:

     + Raise 0 to a negative power or 0

     + Raise a negative number to a non-integer power


"Missing argument number ..."

A required argument was not provided in a function call.


"Missing argument: '...'"

A required argument was not provided in a function call.  Refer to the function documentation for the expected arguments


"Too many arguments"

Too many arguments were specified in a function call.  Refer to the function documentation for the expected arguments.


"Invalid argument name, '...'"

An unknown argument name was specified.  Refer to the function documentation for the argument names.


"Duplicated argument: ..."

The same argument was specified more than once in the argument list.  Here is an example of this error:

      FunctionName( 5, Arg1 = 5 )

If Arg1 is the name of the first argument, the "Duplicate

 argument, 'Arg1'" error will occur.


"Unnamed argument follows a named argument"

An unnamed argument was listed after a named argument in a function argument list.  After the first named argument is listed, all remaining arguments must be named.


"Type mismatch, argument ..."

The specified argument is incompatible with the expected type (specifying a string where a real or an integer value was expected, for example).


"Type mismatch, argument: ..."

The specified argument is incompatible with the expected type (specifying a string where a real or an integer value was expected, for example).


"PRINT statement cannot be used"

The PRINT statement is not supported by the current application.  Do not use PRINT statements in the script.


"Floating-point error: ..."

The floating-point coprocessor (or the coprocessor emulator) has encountered a computational problem.


"File not found"

Unable to locate a specified file.  Check that the file name was typed correctly or that the specified file exists.


"Path not found"

Unable to locate the specified directory.  Check that the directory name was typed correctly or that the specified directory exists.


"Access denied"

Access was denied to a file or directory.  The file may be in use by another application.


"Unable to create ..."

Unable to create the specified file or directory.  The file or directory may already exist.


"Unable to open ..."

The specified file could not be found.  Either the file is not present, in the wrong directory or disk was specified, or you have made a simple spelling error.  Be sure to check where the program is looking for the file.  Often the program is just looking in the wrong directory.


"Cannot read from file"

The program cannot read information from the file.  The file may be corrupted.


"Unable to write to file"

An error occurred while writing the specified file.  This is usually caused by a full disk.  Try specifying a different disk or remove unneeded files from the disk and try again.


"File already open"

An attempt was made to assign the same file number to two files.


"Unable to advance to the end of ..."

A disk error occurred which prevented the file from being advanced to its end.


"Attempt to read past end of file"

An attempt was made to read past the end of the file.  Use the EOF function to check if a file is at the end before reading from the file.


"Maximum line length (... characters) exceeded"

A line in the input file is longer than the maximum allowable the length [1024 characters].  The file might be a binary file.


"File is not open"

The specified file number does not have an open file associated with it.


"Invalid file number"

The specified file number is invalid.  File numbers must be integers between 1 and the 10, inclusive.


"Invalid read/write mode"

Either an attempt was made to write to a file opened for INPUT, or an attempt was made to read from a file opened for OUTPUT or APPEND.


"Maximum property or method nesting (%d levels) exceeded"

Too many object members are being accessed on one line:

Example:

  SET App = CreateObject(Sample.Application)

  Val = App.F1().F2().F3().F4().F5().F6().F7().F8().F9().F10().F11()  <- error

You can have only ten periods after an object name.  To overcome this limitation, set one or more object variables to intermediate values:

SET App = CreateObject(Sample.Application)

SET Temp1 = App.F1().F2().F3().F4().F5()

SET Temp2 = Temp1.F6().F7().F8().F9().F10()

Value = Temp2.F11()


"Expected a subscript expression"

A subscript was not supplied in the parentheses following a variable name.

Example:

DIM A(5) AS REAL

A() = 5        <-- error, expected a subscript expression


"Object array must be dimensioned in a DIM statement"

An attempt to use an object variable array was made without dimensioning the array in a DIM statement.  Arrays of object variables, unlike other variables, are not automatically dimensioned.

Example 1:

SET Obj = CreateObject(Sample.Application)

Obj(1) = 7              <-- error, object array must be dimensioned

val = Obj(1)            <-- this is a valid call to an objects default method

Example 2:

DIM Obj(5) AS OBJECT

SET Obj(1) = CreateObject(Sample.Application)

Obj(1) = 7       This is valid.  The default property of an object is set to 7

val = Obj(1)(5)  This is valid.  The default method of an object is being called


"The OLE subsytem is out of date"
"The OLE subsystem is out of date"

(Win16 Only) The OLE DLLs installed on the users system are out of date.  An installation program  may have erroneously over-written newer files with older files.  Reinstalling GS Scripter should correct the problem.


"Property or method does not return an object"

Objects can be nested within each other.  That is, a method or property of one object may return a new, different object:

SET Object1 = CreateObject(Sample.Application)

SET Object2 = Object1.NestedObject

In this hypothetical example Object1 contains a property called NestedObject that returns a new object.  This NestedObject can itself supply methods and properties:

...

Result = Object2.Value

This error occurs when a method or property is expected to return an object but fails to do so.  For example:

SET Object1 = CreateObject(Sample.Application)

Result = Object1.NestedObject.Value

This two-line script retrieves the Value property of the NestedObject.  However, if the NestedObject property fails to return a new object the property or method does not return an object error will occur.


"Unable to initialize the OLE subsystem"

The OLE subsystem could not be initialized.


"Unexpected OLE Automation Error (error code)

An OLE automation error has occurred.  Re-try the procedure that caused this error.  If the error continues please record the code and notify Golden Software.


"Unrecognized object name"

The specified object name was not found in the system registry.  Check that the object name is spelled properly and that the application which supplies the object is properly installed.


"Object does not support OLE Automation"

The specified object does not support OLE automation.  This object cannot be controlled from Scripter.


"Unable to write to registration database"

An error has occurred in writing to the system registry.


"Object does not support current language settings"

The specified object does not support the current users language settings.


"Propertry or method type is incompatible"
"Property or method type is incompatible"

The value returned by an object property or method is not compatible with Scripter.  For example, Scripter does not support array values when they are returned by an object.


"Wrong number of arguments"

Too many arguments or too few required arguments were provided in a call to an objects method.  Check the application which provides the object for the proper syntax.


"Unknown method or property"

The specified method or property name is not supported by the object.  Check the spelling of the method or property name or check the documentation of the application which supplies the object.


"Method does not accept named arguments"

A named argument was used in a call to an object method that does not support named arguments.  Refer to the application which supplies the object for the proper syntax.


"A required argument is missing"

At least one of an methods required arguments was not provided.  Check the documentation of the application which supplies the object for the proper syntax.


"Unknown named argument"

A named argument in an object method call was not recognized by the object.  Refer to the application which supplies the object for the proper syntax.


"Object doesn't support this property or method"

A property or method name is not recognized by the object.  Refer to the application which supplies the object for methods and properties supplied by the object.


"Unable to execute OLE Automation server program"

The application which supplies the OLE Automation object could not be started.  The system registry entry for the application may be out of date (in which case the application may need to be reinstalled).  In a network environment the workstation may not be connected to the network server.  The PATH environment variable may need to be set to include the directory which contains the application.


"Unable to communicate with OLE Automation server program"

The application which supplies the OLE Automation object stopped responding to Scripter.  In a network environment the workstation may have become disconnected with the network server.


"Unexpected statement call"

A Scripter statement (e.g., open, close, write, line input, print, name) was used out of context.

Example:

Result = Print a$     <-- error


"Unknown name, argument %d"

A named argument in a call to an object method was not recognized by the object.  Refer to the application which supplies the object for methods and properties supplied by the object.


"Type mismatch, argument %d"

The specified argument in a call to an object method has an incorrect type (e.g., a string type where a numeric type was expected).


"Unable to communicate with OLE Automation server (error code)"

The application which supplies an OLE object is not available.  It may have been terminated or it may be occupied with another operation.