Installation

The following provides installation instructions for MATLAB, VBScript and Perl users.

Installation for MATLAB Users

To use MATLAB scripts, you must install an STK-supported version of MATLAB. (Check www.agi.com/matlab for a list of MATLAB versions supported by STK.)

The MATLAB debugger can be used to debug a MATLAB function when the function is called directly from MATLAB itself; however, it is not compatible with functions called from outside MATLAB; using the MATLAB debugger with STK MATLAB plugin scripts can cause both programs to hang or to crash.

Note: If MATLAB was started by STK, then the proper manner to close MATLAB is also from STK. To close MATLAB, open the application Preferences from the Edit: Preferences menu item, go to the MATLAB page, and click the Close MATLAB button to close MATLAB. In fact, the quit command in MATLAB will not quit MATLAB if STK has opened it. The only way to quit MATLAB once started by STK is to quit STK, use the Close MATLAB button as described above or to use the command 'quit force' at the MATLAB prompt.

Installation for VBScript Users

VBScript is automatically installed with Microsoft Windows and is available free. There is no further installation step required.

The VBScript functionality in Windows is enabled through the file atl.dll. To use STK plugin scripts, you must have a copy of VBScript delivered with an STK-supported Windows operating system. The latest version can be downloaded free of charge from Microsoft at its website:

http://activex.microsoft.com/controls/vc/atl.cab

Once the new software is installed, you need to register AgScript.dll as a COM server. Open a Command Prompt and change directories until you are in the directory containing the STK executables and dll's. The AgScript.dll is in this directory. Now run:

regsvr32 AgScript.dll

Stay alert to distinguish between VBScript (Visual Basic Scripting Edition), VB (Visual Basic), and VBA (Visual Basic for Applications). Some keywords and functionality available in VB/VBA are not available in VBScript. Moreover, several VBScript books document features that are not available in VBScript (but are available in VB/VBA). You may want to purchase a VBScript book that is careful about this distinction.

Regsvr32.exe requires administrator rights in order to register a plugin. Once registered, it's available to all users on that machine (provided that the actual file location on the disk does not change).

It is sometimes difficult to find a system administrator to register the plugin though. In this case, we have provided a VBScript utility "register_wsc_hkcu.vbs" located in your install under <STK install folder>\CodeSamples\Extend.

The utility will register a Windows Script Component to the HKEY_CURRENT_USER area of the Windows registry rather than HKEY_LOCAL_MACHINE. To run the utility, open up a command prompt and change directories to the location of the utility. Then enter

cscript register_wsc_hkcu.vbs "Your WSC Name.wsc"

replacing "Your WSC Name.wsc" with the actual full path to the location of your Windows Script Component (WSC) file. The utility will parse your WSC file and make the appropriate entries into the Windows registry. This utility must be run for each user on the machine if they want to use that plugin.

Note: If you use the MS Script Debugger, which Microsoft makes available free of charge to debug VBScript scripts, a syntax error in the script will cause the debugger to stop at that error. However, in general, the MS Script Debugger cannot be used to debug scripts while they are being used by STK.

Installation for Perl Users

You can download Perl, available for free, from activestate.com. Contact AGI Support if you need assistance.

Please note that you may need to set an environmental variable to enable STK plugin scripts to work with Perl. If you experience errors trying to use Perl (with a message indicating that a file could not be found anywhere along the include path variable given by @INC), set a system environmental variable AGPERL_LIB_PATH to the following:

.;[Perl_Install_Directory]/lib;[Perl_Install_Directory]/site/lib

where [Perl_Install_Directory] is the directory where Perl is installed on your computer. Directories (separated by semicolons on a PC, separated by colons on UNIX) in the variable AGPERL_LIB_PATH are added to the include path @INC when Perl is started. On UNIX, AGPERL_LIB_PATH should be set in the user's .cshrc file.

After installing the correct version of Perl, you will need to copy the Perl module STKUtil.pm from the /Connect/PERL_LIB directory into a directory that is on the Perl library search path (i.e., a directory path contained in @INC). Typically, you will copy the file to [Perl_Install_Directory]/lib, where [Perl_Install_Directory] is the directory where Perl is installed on your computer. The STKUtil module exports several utility functions that you may want to use in your own scripts. To use the module, include the line

use STKUtil qw(printOut getInputArray);

near the top of the file. The getInputArray function is a user convenience function for translating between references to an array and the array itself: this is useful for dealing with inputs to Perl scripts from STK (see Function Signatures for Perl). The printOut function can be used to print out lines of text; on a PC, it pops up a message box containing the text that the user must dismiss.

Note for PC Users: You cannot use standard input (stdin), standard output (stdout), and standard error (stderr) to print out any messages. Instead you can print to a file or use printOut (or use Win32::MsgBox() directly) to pop messages up in a dialog box on the screen.

STK Programming Interface 11.0.1