Installation
This topic provides installation instructions for MATLAB, VBScript, and Python 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.
You can use the MATLAB debugger 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.
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
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 as described above, or use the command 'quit force' at the MATLAB prompt.Installation for VBScript users
VBScript is automatically installed with Microsoft Windows and is available for 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.
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 DLLs. 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 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, there is a VBScript utility, register_wsc_hkcu.vbs, in the STK installation directory 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 a command prompt window and change directories to the location of the utility. Enter the following command:
<Your WSC Name> is 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. You must run this utility for each user on the machine if for all who want to use that plugin.
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, you cannot use the MS Script Debugger to debug scripts while they are being used by STK.
Installation for Python Users
You can download Python from www.python.org.
You need to register the Python active scripting engine to use Python plugin scripts in STK.
Registering Python
Follow the instructions below to register the Python scripting engine for Python.
- Install Python.
- Add an environment variable at the System Level:
- PYTHONHOME=<Python Install Directory>
- Add two directories to the PATH environment variable:
- <Python Install Directory>
- <Python Install Directory>\DLLs
- Open a command prompt window with administrator privileges.
- Enter the following command to register the scripting engine:
python "<Python Install Directory>\Lib\site-packages\win32comext\axscript\client\pyscript.py"
- If the command is successfully executed, the message "Registered: Python" will appear on the next prompt line.