DM_CALL_SCRIPT

Syntax

int_val = DM_CALL_SCRIPT ( sc_file, sc_name, arg1, ... );
Input arguments
string sc_file The path name to a script file. This interface does not support the concept of script library as do other applications. 'sc_file' cannot be an empty string. The path can be relative or absolute. Relative path names are searched from system (%PMS_HOME%\dm, %PMS_RUNDIR%\dm) directories. If the file name ends with ".bs" then the file is assumed to be a loadable compiled script file.
string sc_name The name of the script function to be called.
  arg1, ... The argument list for the script function to be called.

Return Values

Standard

Description

This function is used when running a script which must call another script under DM_TOOLS. If calling scripts from scripts in Plant Modeller, P&ID or Piping Isometrics & Spools, use the following:

Plant Modeller

PM_CALL_SCRIPT

P&ID

PD_CALL_SCRIPT

Piping Isometrics & Spools

PI_CALL_SCRIPT

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:

  1. Absolute file path, for example DM_CALL_SCRIPT("C:\temp\script.mac","main")

  2. Relative path, for example DM_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.

  1. The called script is under COS project under category Common. The script call would be like this: DM_CALL_SCRIPT("script.mac","main"). However the script object's name in COS database must be just "script".

  2. The called script is located under COS library under category Common. The script call would be like this: DM_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.

  3. There are equally named scripts under COS project database and under system (%PMS_HOME%\dm) => In that case the system will automatically run the script from project database under category Common.

  4. There are equally named scripts under COS library database and under system (%PMS_HOME%\dm) => In that case the system will automatically run the script from library database under category Common.

  5. 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 Common.

  6. The script is located under system %PMS_HOME%\dm. This means that script file is not found from Common category COS project or library database but user have equally named script in %PMS_HOME%\dm.