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.ini
taken from the Server scripting directory for automatic update of client. If this file is not yet available, use the template from the scripting package.
- Activate the Schneider Modsoft script by entering the Component type ID connection to the script in the section [General])
- If more than one different component type is connected to the script, a new entry is required for each component type.
- Save the file.
- 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
- Open the SchneiderModsoft.script in the text editor
- If necessary, make the adjustments listed in the table below.
- Save the file.
- 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
- Open the file ModsoftCaller.bat in the text editor.
- // swap to Modsoft directory
- c:
- cd Modsofteditor
- C:ModsofteditorModsoft.exe /f%1 %2
- Delete REM upf-file
- del %1
- If necessary, adjust the Modsoft editor directory.
- You can also call another application here (for example, the USB driver for the Modbusplus coupling).
- Save the file.
- Copy the file into scripting directory for automatic update of client.