“Scripting” Page

In addition to the graphical user interface, e!COCKPIT can be operated via scripts. Python is the scripting language.

The interpreter integrated in e!COCKPIT processes commands as well as entire program sequences from a sequence of script commands, i.e., e!COCKPIT is controlled via these commands. In this way, for example, projects can be loaded, compiled and uploaded to the controller.

Python commands can be executed by a script call from the e!COCKPIT user interface (see table) or from the command line directly.
After the call on the command line, e!COCKPIT is launched and executes the respective commands defined by the parameter values.

Note

Additional Information

For information and references to the Python scripting language, please refer to the relevant literature and the Internet. You can also find a quick guide for using and collecting helpful links in the CODESYS online help (keyword “Python”).

Note

Additional Information on the API Reference for Python Commands

The “ScriptEngine.chm” help file for the scripting commands is not implemented in the online help, but is available in the CODESYS installation directory:

„…\WAGO Software\e!COCKPIT\3S CODESYS\CODESYS\Online Help\de\“

The help file contains the Python reference from CODESYS which has been expanded by an e!COCKPIT -specific reference.

If you work with Python, use the e!COCKPIT -specific commands. If there is no e!COCKPIT -specific command for a required function, use the default CODESYS commands. Both commands are described in the API reference. The Backstage view, page “Help” > [Links] > [Sample Projects] has sample scripts for different use cases in e!COCKPIT.
You can find a list of example scripts in this manual under Executing Scripts.

Backstage View, “Scripting” Page
Backstage View, “Scripting” Page
Backstage View Operating Elements, “Scripting” Page

Button

Description

Python Scripting

[Execute Script File]

Opens a dialog to select a Python script file (*.py) and executes the script

[Enable Script Tracing]

Enables or disables script-tracing, i.e., when enabled, script commands are output in the “Messages” panel and also saved to a Python script log file

[Open Script Logfile]

Opens the Python script logfile

[Clear Script Logfile]

Clears the Python script logfile

For additional information see: