A reusable input dialog for Eplan Electric P8 scripts (C#)

Many Eplan Electric P8 scripts need one small answer from the user: a name, a value, or a Yes/No choice. A dialog is a small window that asks for that answer before the script carries on. Eplan scripting lets you build that into your own tools, and a simple input dialog is a good first window to make.
You would use it to name a report, ask for a value before an export, or confirm an action before the script changes anything.

What you will build
A short conversation: the script asks for a report name, handles Cancel and empty input safely, asks a Yes/No confirmation, and shows a final message.
What you will learn
What a class, a method and the [Start] attribute are
How to build a window with a label, a text box and buttons
How a window hands a result back to your code
Why it is wise to handle Cancel and empty input
Before you start
Eplan Electric P8 with scripting available (the example was run in 2026.0.3)
No C# experience required, though basic programming ideas help; the example file explains each new idea in comments
The window is built with Windows Forms, a .NET window toolkit that Eplan scripts can use
How it works
The [Start] attribute marks the method Eplan runs when you load the script. Inside it, the example uses a small DialogHelper class that is included in the same file. It is not part of Eplan or .NET. It has three one-line helpers: Prompt for text, Confirm for Yes/No, and Info for messages. Copy the class into any of your own scripts to reuse it.
string reportName = DialogHelper.Prompt(
"New report",
"What should the report be called?",
"My report");
if (reportName == null)
{
DialogHelper.Info("Cancelled", "No report was created.");
return;
}Prompt returns the typed text, or null if the user pressed Cancel. Checking for null first means pressing Cancel is handled safely. The return line then ends the script right there, so nothing below it runs. The full example also checks for empty input (a name made only of spaces counts as empty) and shows a message asking the user to try again.
Common mistakes
Forgetting to handle Cancel, so the script carries on as if the user had typed something
Accepting empty input, which later creates an item with no name
Assuming the user's input is always valid
Try it yourself
Download the example: https://github.com/justin-walzengineering/Eplan-Scripting-GUI-Examples/tree/main/examples/01-input-dialog
In Eplan: File > Extras > Interfaces > Run, then select InputDialog.cs.
Tested with Eplan Electric P8 2026.0.3 (run in Eplan).
If you would like to experiment, try it in a test project first.
Ideas to extend
Challenge: make the default report name include today's date
Add a second text box, for example a report number
Validate the input (letters and numbers only, maximum length)
Use Prompt to ask for a project property value
Key takeaways
Ask for one thing at a time, and always handle Cancel and empty input
Put repeated window code in a helper class so every script stays short
A reusable helper makes the next script quicker to write
Community spotlight
Who or what: The EPLAN Scripting book and blog by Johann Weiher (Suplanus): https://eplan-scripting.suplanus.de
Why it is worth a look: A guide to scripting Eplan in C# that covers the basics and includes examples, with a free sample to try. If this post made you curious about scripting, it is a good next read.
Good to know: Mostly in German, so a browser translation helps if you read English.
Repository with all examples: https://github.com/justin-walzengineering/Eplan-Scripting-GUI-Examples
Maintained by Justin Walz, Walz Engineering. Questions and ideas for future examples are always welcome, and if you would like help with a script of your own, feel free to get in touch.



Comments