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 you switch servers must be named StartServer_.py for Python or StartServer_.wwd for Basic.
- The scripts must be located in the following paths:
- ~/Library/Application Support/IBM/SPSS Statistics/one/Scripts directory for MacOS.
- %APPDATA%\IBM\SPSS Statistics\one\Scripts directory for Windows.
Note: Regardless of whether you are working in distributed mode or not, all scripts (including the StartServer_ scripts) must be on the client machine. - On Windows, if the scripts directory contains both a Python and a Basic
version of
StartClient_
orStartServer_
, then both versions are run. The Python version is first ran 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 anyStartServer_
scripts.Note: TheStartServer_
scripts also run each time you switch servers, but theStartClient_
scripts are 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 who work 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.