DeletePages
Mit diesem Script kann man beliebige Seiten im Projekt löschen. Es können mehrere Seiten mit Pipe |
getrennt angegeben werden. Beispiel-Aufruf:
DeletePages /Pages:"=TEST/11|=TEST/12"
Ist eine angegebene Seite im Projekt nicht vorhanden, wird eine Systemmeldung ausgegeben.
using Eplan.EplApi.ApplicationFramework; using Eplan.EplApi.Base; using Eplan.EplApi.Scripting; public class DeletePages { [DeclareAction("DeletePages")] public void Action(ActionCallingContext acc) { string pagesString = null; acc.GetParameter("Pages", ref pagesString); if (string.IsNullOrEmpty(pagesString)) { new Decider().Decide(EnumDecisionType.eOkDecision, "Parameter 'Pages' missing.", "DeletePages", EnumDecisionReturn.eOK, EnumDecisionReturn.eOK, null, false, EnumDecisionIcon.eFATALERROR); return; } var pages = pagesString.Split('|'); foreach (var page in pages) { DeletePage(page); } } private void DeletePage(string page) { ActionCallingContext accPage = new ActionCallingContext(); accPage.AddParameter("PAGENAME", page); var isPageValid = new CommandLineInterpreter().Execute("edit", accPage); if (isPageValid) { using (new QuietModeStep(QuietModes.ShowNoDialogs)) { new CommandLineInterpreter().Execute("XGedSelectPageAction"); new CommandLineInterpreter().Execute("GfDlgMgrActionIGfWindDelete"); } } else { new BaseException("Page not found: " + page, MessageLevel.Error).FixMessage(); } } }