Script example: editor integration for Schneider Modsoft components¶
This script solution enables optimization in handling Schneider Modsoft components.
Required files for this script function¶
File name | Description | Functionality |
---|---|---|
ScriptBeforeEdit.exe | Provided in the script package | Depending on the component type ID, links the project file configurably with an editor |
ScriptBeforeEdit.ini | Can be edited with a text editor | Defines the BeforeEdit script for a specific component type ID |
SchneiderModsoft.script | Can be edited with a text editor | Script that is processed by the script interpreter |
ModsoftCaller.bat | Can be edited with a text editor | Batch file for calling the Modsoft editor or another editor |
Prerequisites for the script solution¶
- The Schneider Modsoft editor must be installed and licensed on all computers for which the editor integration is to be set up in conjunction with the UserClient.
- It is recommended that the Modsoft installation is located in the same directory on all computers (example
C:\Modsoft\editor
).
Setting up the script¶
Activating ScriptBeforeEdit.exe¶
Copy the application to the Server scripting directory for automatic update of client tab.
Editing ScriptBeforeEdit.ini¶
We recommend that you add any existing ScriptBeforeEdit.ini
file from the Server scripting directory for automatic update of client tab. If this file does not (yet) exist, please use the template from the script package.
- Activate the Schneider Modsoft script by entering the connection from the component type ID to the script in the [General] section.
- If several different component types are to be linked to the script, a new entry must be made for each component type ID.
- Save the file.
- Copy the file to the Server scripting directory for automatic update of client tab.
Example:
Specific example:
Editing SchneiderModsoft.script¶
- Open the
SchneiderModsoft.script
file in the text editor. - If necessary, make the adjustments listed in the following table.
- Save the file.
- Copy the file to the Server scripting directory for automatic update of client tab.
Script¶
Function ScriptBeforeEdit
{
$def::var1 = C:\Modsoft\Editor
$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::var1\RUNTIME
write.line tmp_directory $def::var1\TMP
write.line files_directory $def::var3
write.line names_directory $def::var
}
// Customize ENV:
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::myrundir\ModsoftCaller.bat
dest $def::var1\ModsoftCaller.bat
}
// Execute Modsoft batch:
call $def::var1\ModsoftCaller.bat
{
arg $def::var2.upf
arg $def::var2.env
wait 0
}
done
}
Customizations¶
Line 3:
Adjust the absolute path to the Modsoft editor here.
Line 37:
In this example, only the file name is passed as an argument. For an absolute specification of the UPF file, this line is: arg $def::var1\$def::var2.upf.
Line 38:
In this example, only the file name is passed as an argument. For an absolute specification of the ENV file, this line is: arg $def::var3\$def::var2.upf.
Line 39:
Remove line if you want to wait until the editor is closed.
Editing ModsoftCaller.bat¶
-
Open the
ModsoftCaller.bat
file in the text editor. -
If necessary, adjust the Modsoft Editor directory.
- You can also call up another application here (e.g. the USB driver for the Modbusplus coupling).
- Save the file.
- Copy the file to the Server scripting directory for automatic update of client tab.