Startup Scripts
You can create a script that runs at the start of each session and a separate script that runs each time you switch servers. For Windows you can have versions of these scripts in both Python and Basic. For all other platforms, the scripts can only be in Python.
- The startup script must be named StartClient_.py for Python or StartClient_.wwd for Basic.
- The script that runs when switching servers must be named StartServer_.py for Python or StartServer_.wwd for Basic.
- The scripts must be located in the scripts directory of the installation directory--located at the root of the installation directory for Windows, and under the /Applications/IBM SPSS Statistics/Resources directory for MacOS. Note that regardless of whether you are working in distributed mode, all scripts (including the StartServer_ scripts) must reside on the client machine.
- On Windows, if the scripts directory contains both a Python and a Basic version of StartClient_ or StartServer_ then both versions are executed. The order of execution is the Python version followed by the Basic version.
- If your system is configured to start up in distributed mode, then at the start of each session any StartClient_ scripts are run followed by any StartServer_ scripts. Note: The StartServer_ scripts also run each time you switch servers, but the StartClient_ scripts only run at the start of a session.
Example
This is an example of a StartServer_ script that maps a drive letter to a shared network resource specified by a UNC identifier. This allows users working in distributed mode to access data files on the network resource from the Open Remote File dialog box.
#StartServer_.py
import SpssClient
SpssClient.StartClient()
SpssClient.RunSyntax(r""" HOST COMMAND=['net use y: \\myserver\data']. """)
SpssClient.StopClient()
The SpssClient.RunSyntax
method
is used to run a HOST
command
that calls the Windows net use
command
to perform the mapping. When the StartServer_ script runs, IBM® SPSS® Statistics is in distributed
mode so the HOST
command runs
on the IBM SPSS Statistics Server machine.