All ribbon buttons in P8 are linked to an action. This means that when a ribbon button is called, the corresponding action is executed. In order to execute an action via EPLAN API, you have to create an Action object and execute the action with the Execute method.
In order to create an Action object, you need to know the action by its name. You have to create a new ActionManager object and call the FindAction function, which takes the name of the action as parameter.
To pass and evaluate action parameters, you need the ActionCallingContext class:
To find out which action is linked to which ribbon button, you can evaluate the onActionStart.String.* event. Alternatively, after clicking the ribbon button, press [Ctrl] + [VK_OEM_5] to show the Diagnostics Dialog. [VK_OEM_5] corresponds to the [^] key on a German keyboard or to the [\] on a United States 101 keyboard.
For a list of automatic actions, refer to the topic "Automatic Actions".
Important:
Please mind that an action may modify the ActionCallingContext during its execution. For example, sometimes project IDs are added to the context and are passed to an inner action. Reusing the same ActionCallingContext for another action call may lead to unexpected results. So in most cases it is advisable to create a new ActionCallingContext for a new action call.
To extend the EPLAN command line with new commands and parameters, you need to implement an action. The action can have its own parameters and can call other API functions.
In this way an action is executed just after starting EPLAN, for example:
EPLAN.EXE /Variant:"Electric P8" /NoLoadWorkspace action /Param1:value1 /Param2:value2 /Param3:value3
The parameter without a flag (/ or -) is interpreted as the name of an action to be executed. All following parameters are passed to the action. Only one action is allowed per command line call.
A script can also contain and register an action. This means that it can also evaluate action parameters.
It is necessary to pass more general command line parameters before the action name.
List of general command line parameters evaluated by EPLAN:
Parameter
|
Description
|
/Variant
|
Select the product variant you want to start. E.g. "Electric P8" or "Fluid"
|
/NoLoadWorkspace
|
No workspace is loaded or restored.
|
/NoSplash
|
No splash screen is shown on system start.
|
/Language:en_us
|
EPLAN is started with GUI language "English". The language predefined in the settings of EPLAN will not be changed.
|
/Auto
|
EPLAN is shut down after executing the command line.
|
/Quiet
|
No dialogs are shown while a command line is being executed.
|
/Frame:0
|
|
/Setup
|
All Settings are restored to their installation default
|
<action name>
|
The action will be executed, all following parameters (starting with / or –) are passed to the action as parameters.
|
Any command line parameter after the action name is passed as parameter to the action. The parameters are wrapped into an ActionCallingContext as string parameters and can be extracted by the action. Please note that the parameter names on the command line and in the ActionCallingContext must be spelled in the exactly the same:
EPLAN.EXE /Variant:"Electric P8" action /Param1:value1 /Param2:value2 /Param3:value3
Warning: When starting EPLAN from the command line with an action, then no previously opened projects are opened at the beginning of the session.