The scripting functionality also accepts parameters. However, this only makes sense if a /Param parameter is transferred to a script when it is started. This is possible by calling up EPLAN using the command line:
W3u.exe ExecuteScript /ScriptFile:<Value> /Param:<Value>
If EPLAN is started via the command line in order to execute a script, the first parameter is the action to be executed. The action for executing scripts is called ExecuteScript. This action contains the /ScriptFile parameter through which the name of the script to be executed is specified. Every additional parameter (Param1, Param2, Param3, ...) is transferred to the start function of the script.
In the following example (in C#) the script (the script function) needs the three string parameters Param1, Param2 and Param3:
public class SimpleScriptWithParameters { [Start] public void FunctionWithParameters(String Param1, String Param2, String Param3) { MessageBox.Show(Param1 + Param2 + Param3, "SimpleScriptWithParameters") return; } }
The same example in Visual Basic.Net looks like this:
Public Class SimpleScriptWithParameters <Start> _ Public Sub FunctionWithParameters(ByVal Param1 As String, ByVal Param2 As String, ByVal Param3 As String) MessageBox.Show(Param1 + Param2 + Param3, "SimpleScriptWithParameters") Return End Sub 'FunctionWithParameters End Class 'SimpleScriptWithParameters
It is important that all parameters used in the script function are also transferred as such in the callup. Otherwise the script is not executed.
For use with EPLAN Electric P8, you can specify the entry in the command line under the Windows 7 operating system as follows:
"C:\Program Files (x86)\EPLAN\Electric P8\<version number>\BIN\W3u.exe" ExecuteScript /ScriptFile:"C:\Users\Public\EPLAN\Electric P8\Scripte\<company code>\SimpleScriptWithParameters.cs" /Param1:Hello /Param2:" EPLAN " /Param3:User!
Using this function, you can extend the EPLAN command line callup with your own parameters.
By using only command line parameters like /NoSplash, /Frame:0 and /Auto you can start the program invisibly and close it again after executing the scripts.
See also