Code:
using System;
using System.Diagnostics; // Zusätzlich
using System.Windows.Forms;
using Eplan.EplApi.Base;
using Eplan.EplApi.Scripting;public class Class
{
[DeclareAction("StartProcess")]
public void Function(string PROCESS, string PARAMETER)
{
try
{
Process.Start(PROCESS, PARAMETER);
}
catch (Exception ex)
{
MessageBox.Show(
ex.Message,
"Fehler",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
}
return;
}
[DeclareMenu]
public void MenuFunction()
{
Eplan.EplApi.Gui.Menu oMenu = new Eplan.EplApi.Gui.Menu();
string quote = "\"";
uint MenuID = new uint(); // Menü-ID vom neu erzeugten Menü
MenuID = oMenu.AddMainMenu(
"PDF-Kataloge", // Name: Menü
"Hilfe", // neben Menüpunkt
"Rolf Janssen GmbH: Eplan P8 Projektierungsrichtlinie", // Name: Menüpunkt
"StartProcess /PROCESS:"
+ quote + @"\\janssen-svr2\EPLAN\Vorlagen und Handbücher\RJ_Projektierungsrichtlinie_Konstruktion V1.2.pdf" + quote
+ " /PARAMETER:''", // Name: Action
"PDF öffnen...", // Statustext
1 // 1 = Hinter Menüpunkt, 0 = Vor Menüpunkt
);
MenuID = oMenu.AddMenuItem(
"Schaltungsbuch Möller/Eaton", // Name: Menüpunkt
"StartProcess /PROCESS:"
+ quote + @"\\janssen-svr4\daten\kataloge\allgemein\Möller Schaltungsbuch.pdf" + quote
+ " /PARAMETER:''", // Name: Action
"PDF öffnen...", // Statustext
MenuID, // Menü-ID: Einfügen/Fenstermakro...
1, // 1 = Hinter Menüpunkt, 0 = Vor Menüpunkt
false, // Separator davor anzeigen
false // Separator dahinter anzeigen
);
MenuID = oMenu.AddPopupMenuItem(
"Siemens", // Name: Menü
"Hauptkatalog IC10 (2012)", // Name: Menüpunkt
"StartProcess /PROCESS:"
+ quote + @"\\janssen-svr4\daten\kataloge\siemens\IC10\SIRIUS_IC10_complete_German_2012.pdf" + quote
+ " /PARAMETER:''", // Name: Action
"PDF öffnen...", // Statustext
MenuID, // Menü-ID
1, // 1 = hinter Menüpunkt, 0 = vor Menüpunkt
false, // Separator davor anzeigen
false // Separator dahinter anzeigen
);
oMenu.AddMenuItem(
"Hauptkatalog ST70 (2011)", // Name: Menüpunkt
"StartProcess /PROCESS:"
+ quote + @"\\janssen-svr4\daten\kataloge\siemens\ST70\simatic_st70_complete_german_2011.pdf" + quote
+ " /PARAMETER:''", // Name: Action
"PDF öffnen...", // Statustext
MenuID, // Menü-ID
1, // 1 = hinter Menüpunkt, 0 = vor Menüpunkt
false, // Separator davor anzeigen
false // Separator dahinter anzeigen
);
MenuID = oMenu.AddPopupMenuItem(
"Tools", // Name: Menü
"Windows-Zeichentabelle", // Name: Menüpunkt
"StartProcess /PROCESS:charmap /PARAMETER:''", // Name: Action
"Windows-Zeichentabelle öffnen...", // Statustext
MenuID, // Menü-ID
1, // 1 = hinter Menüpunkt, 0 = vor Menüpunkt
false, // Separator davor anzeigen
false // Separator dahinter anzeigen
);
MenuID = oMenu.AddMenuItem(
"Kabelberechnung", // Name: Menüpunkt
"StartProcess /PROCESS:"
+ quote + @"\\janssen-svr4\daten\kataloge\allgemein\tools\kabel.exe" + quote
+ " /PARAMETER:''", // Name: Action
"Kabelberechnung öffnen...", // Statustext
MenuID, // Menü-ID
1, // 1 = hinter Menüpunkt, 0 = vor Menüpunkt
false, // Separator davor anzeigen
false // Separator dahinter anzeigen
);
return;
}
}