1. Home
  2. Knowledge Base
  3. Octoplant Server
  4. Tutorials
  5. Scripting
  6. ScriptingPackageExamples
  7. KB-126998: Example for integrating the script editor for Schneider Modsoft components

KB-126998: Example for integrating the script editor for Schneider Modsoft components

Example for integrating the script editor for Schneider Modsoft components

This scripting solution enables an improvement with regard to the use of Schneider Modsoft components.

Necessary files for this script function:

File nam Description Functio
ScriptBeforeEdit.exe Available in the scripting package Links the configurable project file with an editor, depending on the Component type ID
ScriptBeforeEdit.ini Can be edited with a text editor Defines the script BeforeEdit for a specific component type ID
SchneiderModsoft.script Can be edited with a text editor Script, which was processed by the script interpreter
ModsoftCaller.bat Can be edited with a text editor Batch file for opening the Modsoft editor or another editor

Requirements for the script solution

  • The Schneider Modsoft editor needs to be installed and licensed on all computers for the editor integration is to be set up in interaction with the UserClient
  • We recommend that you install Modsoft on all computers under the same directory (for example, C:Modsofteditor)

Set up script

Activate ScriptBeforeEdit.exe

Copy the application into the Server scripting directory for automatic update of client

Edit ScriptBeforeEdit.ini

We recommend that you edit theScriptBeforeEdit.initaken from the Server scripting directory for automatic update of client. If this file is not yet available, use the template from the scripting package.

  1. Activate the Schneider Modsoft script by entering the Component type ID connection to the script in the section [General])
  2. If more than one different component type is connected to the script, a new entry is required for each component type.
  3. Save the file.
  4. Copy the file into the Server scripting directory for automatic update of client.

Example:

1 2 3

[General] // Mapping for CoDeSys editor component type<ComponentTypeID>=SchneiderModsoft

Specific example:

1 2

[General] 5A527AA2D4A846208BB8648EED1146BD=SchneiderModsoft


SchneiderModsoft.script

  1. Open the SchneiderModsoft.script in the text editor
  2. If necessary, make the adjustments listed in the table below.
  3. Save the file.
  4. Copy the file into the Server scripting directory for automatic update of client.

Script:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 43 43

Function ScriptBeforeEdit { $def::var1 = C:ModsoftEditor $def::var2 = $func::getfilename($vdog::specific->SelectedFile) $def::var3 = $func::getshortdir($vdog::specific->WorkingDir)

// Create UPF file: file.create $def::var1$def::var2.upf { write.line rt_directory $def::var1RUNTIME write.line tmp_directory $def::var1TMP write.line files_directory $def::var3 write.line names_directory $def::var }

// ENV edit: file.replace $def::var3$def::var2.env { row.1 $def::var3 row.2 $def::var3 row.3 $def::var3 row.4 $def::var3 row.5 $def::var3 }

// Update Modsoftcaller: file.copy { source $vdog::myrundirModsoftCaller.bat dest $def::var1ModsoftCaller.bat }

// Execute Modsoft-Batch: call $def::var1ModsoftCaller.bat { arg $def::var2.upf arg $def::var2.env wait 0 }

done }

Lines Descriptio
3 Edit the absolute path to the Modsoft editor.
3 In this example, only the file name is given as argument.The line for the absolute specification of the UPF file: arg $def::var1$def::var2.upf
3 In this example, only the file name is given as argument.The line for the absolute specification of the ENV file: arg $def::var3$def::var2.upf
3 Remove line, if you want to wait until the editor is closed.

Edit ModsoftCaller.bat

  1. Open the file ModsoftCaller.bat in the text editor.
    1. // swap to Modsoft directory
  2. c:
  3. cd Modsofteditor
  4. C:ModsofteditorModsoft.exe /f%1 %2
  5. Delete REM upf-file
  6. del %1
  7. If necessary, adjust the Modsoft editor directory.
  8. You can also call another application here (for example, the USB driver for the Modbusplus coupling).
  9. Save the file.
  10. Copy the file into scripting directory for automatic update of client.

Last update: September 15, 2023

Related Articles

IMPRINT | PRIVACY POLICY | COOKIE POLICY

Privacy Preference Center