SpssScriptContext Class (Python)
The SpssScriptContext
class
provides access to the object that triggers an autoscript as well
as the associated output document object. Autoscripts are scripts
that run automatically when triggered by the creation of specific
pieces of output from selected procedures. Scripts are specified as
autoscripts and associated with output items (that trigger them) from
the Scripts tab of the Options dialog.
SpssScriptContext
objects are only for use when writing a script that will be used
as an autoscript. They have a value of None
if referenced by a script that is not being run as an autoscript.
You get an SpssScriptContext
object from the GetScriptContext method
of the SpssClient
object.
Example: Get the Output Item that Triggered an Autoscript
import SpssClient
SpssClient.StartClient()
SpssScriptContext = SpssClient.GetScriptContext()
SpssOutputItem = SpssScriptContext.GetOutputItem()
The GetOutputItem
method of the SpssScriptContext
object returns the output item (SpssOutputItem
object) that triggered the current autoscript.