Ich hatte mal schon geschrieben wie man die Projekt-Sprachen rausfindet…
Hier noch ein Script wie man die variable Sprache herausfindet.
Einfach das Script laden und in einem anderen Script das Usage ausführen.
using System.IO; using System.Xml; using Eplan.EplApi.ApplicationFramework; using Eplan.EplApi.Base; using Eplan.EplApi.Scripting; class GetProjectVariableLanguage { /* Usage private static string GetProjectVariableLanguage() { string value = null; ActionCallingContext actionCallingContext = new ActionCallingContext(); new CommandLineInterpreter().Execute("GetProjectVariableLanguage", actionCallingContext); actionCallingContext.GetParameter("value", ref value); return value; } */ private readonly string TempPath = Path.Combine( PathMap.SubstitutePath("$(TMP)"), "GetProjectLanguages.xml"); [DeclareAction("GetProjectVariableLanguage")] public void Action(out string value) { ActionCallingContext actionCallingContext = new ActionCallingContext(); actionCallingContext.AddParameter("prj", FullProjectPath()); actionCallingContext.AddParameter("node", "TRANSLATEGUI"); actionCallingContext.AddParameter("XMLFile", TempPath); new CommandLineInterpreter().Execute("XSettingsExport", actionCallingContext); if (File.Exists(TempPath)) { string languagesString = GetValueSettingsXml(TempPath, "/Settings/CAT/MOD/Setting[@name='VAR_LANGUAGE']/Val"); if (languagesString != null) { value = languagesString; return; } } value = null; return; } // Returns the EPLAN Project Path private static string FullProjectPath() { ActionCallingContext acc = new ActionCallingContext(); acc.AddParameter("TYPE", "PROJECT"); string projectPath = string.Empty; new CommandLineInterpreter().Execute("selectionset", acc); acc.GetParameter("PROJECT", ref projectPath); return projectPath; } // Read EPLAN XML-ProjectInfo and returns the value private static string GetValueSettingsXml(string filename, string url) { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(filename); XmlNodeList rankListSchemaName = xmlDocument.SelectNodes(url); if (rankListSchemaName != null && rankListSchemaName.Count > 0) { // Get Text from MultiLanguage or not :) string value = rankListSchemaName[0].InnerText; return value; } else { return null; } } }
Hinterlasse einen Kommentar