Using Scripts

With the scripting feature in CODESYS, you can automate commands or complex program operations that you would otherwise have to do manually with mouse clicks and text input in the CODESYS user interface. You can start these scripts from the CODESYS user interface (command or configured toolbar) or from the Windows command line.

Examples of use cases

  • Integration of CODESYS in automatic build server environments:
    • Continuous Integration (CI)
    • Continuous Delivery (CD)
    • Continuous Testing
  • Integration with third-party software, for example:
    • Code generators
    • Creation of projects that are custom tailored to a specific machine configuration
  • Creation of documentation
  • Updating of libraries:
    • Setting of project information during the release process
  • Automatic testing:
    • Mostly in connection with the CODESYS Test Manager
  • Outputting variables via monitoring APIs

See also

Scripting language

The CODESYS scripting language is modular and based on IronPython. For this purpose, the CODESYS “ScriptEngine” component combines the IronPython interpreter with the CODESYS development environment. Then you can use the extensive Python framework libraries, which includes file access in networks and much more.

CODESYS does not yet include its own Python editor. Create your scripts with any text editor or the Python editor.

See also

Architecture of the ScriptEngine, Extension possibilities

The (Iron)Python scripting language used in CODESYS allows for access to the CODESYS scripting APIs for controlling CODESYS operations. Moreover, it lets users effectively apply both the Python standard library and third-party Python modules, as well as third-party .NET framework libraries and .NET assemblies.

Users can execute the scripts from menu commands or configured toolbars in the CODESYS interface or from the Windows command line. Add-ons such as the CODESYS Test Manager also provide ways to execute scripts.

There is not an integrated Python editor in CODESYS. Use your favorite text editor or the Python development environment.

With the Automation Platform APIs, the ScriptEngine APIs can be extended. Examples for this are CODESYS Test Manager and CODESYS SVN. Both provide their own objects and methods as an extension to the scripting APIs. In addition, the CODESYS Test Manager allows for the execution of scripts in a test case. For more information, refer to the respective API documentation of the add-on. Registered Automation Platform users will find more information in the CODESYS Developer Network.

See also