You can get the relative path of the SPSS syntax (provided it is saved) using python.
SpssClient.GetDesignatedSyntaxDoc().GetDocumentPath()
, , pythons os ( ). , . , , , SPSS ( GET, INCLUDE ).
* Run this in any saved SPSS syntax to test *.
begin program.
import spss,spssaux,SpssClient, os
SpssClient.StartClient()
synPathL0U = os.path.dirname(SpssClient.GetDesignatedSyntaxDoc().GetDocumentPath())
SpssClient.StopClient()
synPathL1U=os.path.dirname(synPathL0U)
synPathL2U=os.path.dirname(synPathL1U)
print "synPathL0U =",synPathL0U
print "synPathL1U =",synPathL1U
print "synPathL2U =",synPathL2U
spss.SetMacroValue("!synPathL0U",spssaux._smartquote(synPathL0U+"\\"))
spss.SetMacroValue("!synPathL1U",spssaux._smartquote(synPathL1U+"\\"))
spss.SetMacroValue("!synPathL2U",spssaux._smartquote(synPathL2U+"\\"))
end program.
.
echo !synPathL0U.
echo !synPathL1U.
echo !synPathL2U.
, , .
BEGIN PROGRAM/END PROGRAM Run(args) python, , , SET_JOB_CWD.py. , , .
, SET_JOB_CWD.py :
def Run(args):
import spss,spssaux,SpssClient, os
SpssClient.StartClient()
synPathL0U = os.path.dirname(SpssClient.GetDesignatedSyntaxDoc().GetDocumentPath())
SpssClient.StopClient()
synPathL1U=os.path.dirname(synPathL0U)
synPathL2U=os.path.dirname(synPathL1U)
spss.SetMacroValue("!synPathL0U",spssaux._smartquote(synPathL0U+"\\"))
spss.SetMacroValue("!synPathL1U",spssaux._smartquote(synPathL1U+"\\"))
spss.SetMacroValue("!synPathL2U",spssaux._smartquote(synPathL2U+"\\"))
SET_JOB_CWD.xml , :
<Command xmlns="http://xml.spss.com/extension" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="SET JOB CWD" Language="Python">
</Command>
, ( , SHOW EXTPATHS. SPSS, , "EXTPENHS EXTENSIONS", - .
, SPSS. SET JOB CWD., SPSS !synPathL0U, !synPathL1U, !synPathL2U, , .