PD_CALL_SCRIPT
Syntax
- Input arguments
-
string Script_file The path name to the script file. If empty string, then the script is assumed to be found from the script library. The path can be relative or absolute. Relative path names are searched from system (%PMS_HOME%\dw, %PMS_RUNDIR%\dw) directories. If path name ends with ".bs", then the file is assumed to be a loadable compiled script file. string Script_name The name of the script function to be called.
- Optional input/Output arguments
-
arg1, arg2, ... The arguments for the script function.
Return Values
- Success:
-
Return value of the called script file.
- Failure:
-
int -1 Script interface error.
Description
This function calls a script in another script file.
In version 5 there can be script(s) that are saved into COS database. Due this the loading functionality of this api is extended.
Below here is the loading functionality when you call the script by using FILEPATHS:
-
Absolute file path, for example PD_CALL_SCRIPT("C:\temp\script.mac","main")
-
Relative path, for example PD_CALL_SCRIPT(".\script.mac","main"). This would mean that script is run from the directory ...\YourProject.pms\YourWorkspace.wsp\script.mac
Below there is description about the loading functionality in the case that you call the script by using COS DATABASE:
Notice that when loading the script from COS it is enough that you just write the script's name into 'sc_lib' variable.
-
The called script is under COS project under category Pd. The script call would be like this: PD_CALL_SCRIPT("script.mac","main"). However the script object's name in COS database must be just "script".
-
The called script is located under COS library under category Pd. The script call would be like this: PD_CALL_SCRIPT("script.mac","main"). However the script object's name in COS database must be just "script". As you can see the script call is the same than calling the script from project. The only difference is that script from library is run only if there is no script in project with the same name. See section 5 also.
-
There are equally named scripts under COS project database and under system (%PMS_HOME%\pd) => In that case the system will automatically run the script from project database under category Pd.
-
There are equally named scripts under COS library database and under system (%PMS_HOME%\pd) =>In that case the system will automatically run the script from library database under category Pd.
-
There are equally named scripts under COS library database and under COS project database => In that case the system will automatically run the script from project database under category Pd.
-
The script is located under system %PMS_HOME%\pd. This means that script file is not found from Pd category COS project or library database but user have equally named script in %PMS_HOME%\pd.