EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers.

Script Example 7: Manipulation of the Project information Object

Overview

The script ProjectInfoExample.py, provides information in the Project information object. Important information items, such as Title and Version, have explicit properties. However, you can read and write the other information fields by using the dictionary syntax. For example, those that are recommended for the properties of a library project.

The example below may seem unrealistic, but similar code is used in build servers that create, test, and possibly release automatic library projects and other projects. The ScriptEngine is one of the key elements for creating CI (Continuous Integration) and CD (Continuous Delivery) systems.

ProjectInfoExample.py

# encoding:utf-8
from __future__ import print_function

proj = projects.load("D:\Some.library")

info = proj.get_project_info()

# Set some values
info.company = "Test Library Ltd"
info.title = "Script Test Project"
info.version = (0, 8, 15, 4711)
info.default_namespace = "testlibrary"
info.author = "Python von Scriptinger"

# some values recommended in the library toolchain
info.values["DefaultNamespace"] = "testlibrary"
info.values["Placeholder"] = "testlibrary"
info.values["DocFormat"] = "reStructuredText"

# now we set a custom / vendor specific value.
info.values["SpecialDeviceId"] = "PLC0815_4711"

# Enable generation of Accessor functions, so the IEC
# application can display the version in an info screen.
info.change_accessor_generation(True)

# And set the library to released
info.released = True;

proj.save()