Script Project Manager

Developers of larger script applications can make the development project more manageable by dividing the code into several smaller source code files that call each other with *_CALL_SCRIPT externs. To improve run-time performance, the called scripts are usually precompiled.

The Script Project Manager tool allows the script developer to compile all the source code files of a modular development project at one go and then run and debug the code.

If there are several different script development projects, they must be located under the same root directory.

Setting Up the Project Configuration File

You must create a project configuration file for each script project that you want to build with the Script Project Manager tool. This configuration file defines where the source files are and where the compiled files are placed when the project is built.

Create the project configuration file with a text editor, using CADMATIC tag records as described below, and save the file with the *.btn file extension.

Here is an example of a project configuration file:

This table lists the tags that you can use in the project configuration file:

When a tag defines a file path, consider the following:

  • You can use environment variables in the path if you add the $ character in front of the environment variable: $PMS_HOME

  • You can use $CCS_SYST in the path to refer to the root directory of your source code tree. This environment variable is set when you first select the root folder in Script Project Manager and then build the project.

Using the Script Project Manager

You can use the Script Project Manager tool to compile and run your scripts.

Prerequisites

Do the following:

  1. In Plant Modeller, select Tools > Script.

  2. Select the script source file %PMS_HOME%\pm\macro\PmMgeScriptProject.mac and click Open.

    The Script Project Manager dialog opens.

  3. Select the configuration file you have created for this script development project:

    1. Click Select.

    2. Select the .btn file and click Open.

    Note: This file defines where the program can find the source code files and where it should place the compiled files.

  4. Select the root directory of your source code tree:

    1. Click Select.

    2. Select the source code directory and click Select Folder.

    Note: This path is set to the CCS_SYST environment variable when you build the project.

  5. Build the project:

    1. Select whether to compile only those source files that are younger than the latest successful build.

      Note: The program does not resolve dependencies. If there is a source file that has not been modified but it contains an #include for a header file that has been modified, the source file is not compiled unless you clear this option.

    2. Click Build.

      The program builds the application as defined in the project configuration file and shows the status in the dialog. If the program ran into errors, the error messages are listed in the dialog.

    3. If you want to view the complete build log, click Open Build Log. The program opens a text file that contains the information of the previous builds.

  6. If the build was successful, you can run the script:

    1. Click Select.

    2. Select the main script file that you want to run and click Open.

      The file path is shown in the dialog.

    3. Click Run as Script. The dialog is hidden and then shown again when the execution of the script has completed.

  7. Click Done.

Running Script Project Manager from the Ribbon

If you intend to use the Script Project Manager script regularly, you can add a command for it to the application ribbon.

You can add custom commands to the ribbon by defining a "Custom UI" object—here is an example:

If you store the "Custom UI" object in the library, remember to approve it for use in the project.

Related Topics

Customizing the ribbon