You also have the option of integrating automatic actions in a simple script. Using these Eplan actions you can automatically run different program functions (e.g. Back up data, Print, etc.).
After the class, the
The overall structure of such a simple C# script thus looks like this:
public class <ScriptName>
{
[Start]
public void <FunctionName>
{
ActionCallingContext <ActionName>Context = new ActionCallingContext ();
<ActionName>Context .AddParameter("<ActionParameter1>","<Value>");
<ActionName>Context .AddParameter("<ActionParameter2>","<Value>");
...
new CommandLineInterpreter().Execute("<ActionName>",<ActionName>Context);
return;
}
}
The following example shows a script in C# with the Eplan action Print:
public class PrintScript
{
[Start]
public void PrintFunction()
{
ActionCallingContext printContext = new ActionCallingContext ();
printContext .AddParameter("NUMBER","1");
printContext .AddParameter("PRINTCHANGEDPAGES","0");
printContext .AddParameter("PRINTREVERSE","0");
printContext .AddParameter("PRINTCOLLATE","0");
printContext .AddParameter("PRINTERNAME",@"\\FUEMON\Kyocera FS-1700+ TechDok KX");
printContext .AddParameter("PROJECTNAME",@"C:\Program Files\EPLAN\Electric P8\Projects\EPLAN\EPLAN_Sample_Project.elk);
printContext .AddParameter("TYPE","PAGES");
printContext .AddParameter("PAGENAME","=GB1+A1&EFS1/1");
new CommandLineInterpreter().Execute("print",printContext);
return;
}
}
Using ActionCallingContext the parameter set for the PrintFunction function is specified in the example above. Then the different parameters and the associated values for the Print action are listed. This is how you specify the number of copies, for example, using the NUMBER parameter. In the example, the value "1" is entered here. Select Execute to run the Print action.
The same example in Visual Basic.Net looks like this:
Public Class PrintScript
{
<Start> _
Public Sub PrintFunction()
Dim printContext As New ActionCallingContext ()
printContext .AddParameter("NUMBER","1")
printContext .AddParameter("PRINTCHANGEDPAGES","0")
printContext .AddParameter("PRINTREVERSE","0")
printContext .AddParameter("PRINTCOLLATE","0")
printContext .AddParameter("PRINTERNAME", "\\FUEMON\Kyocera FS-1700+ TechDok KX")
printContext .AddParameter("PROJECTNAME", "C:\Program Files\EPLAN\Electric P8\Projects\EPLAN\EPLAN_Sample_Project.elk)
printContext .AddParameter("TYPE","PAGES")
printContext .AddParameter("PAGENAME",""=GB1+A1&EFS1/1")
Dim commandLineInterpreter As New CommandLineInterpreter()
CommandLineInterpreter.Execute("print",printContext)
Return
End Sub 'PrintFunction
End Class 'PrintScript
Tip:
The command Automated processing (command path: File > Extras > Command group Extensions > Interfaces > Command group Automated processing > Automated processing) uses simple scripts to automate actions. You can use these scripts to create new scripts. Before you can run the scripts (command path: File > Extras > Command group Extensions > Interfaces > Command group Scripts > Run), you have to remove the AutoTreat function for the parameter String ProjectName and the line in which this parameter is used.
See also
