| |
 | Gut zu wissen: Hilfreiche Tipps und Tricks aus der Praxis prägnant, und auf den Punkt gebracht für EPLAN |
| |
 | Die neue Eplan Plattform 2025: smarte Features für einfacheres, schnelleres Engineering, eine Pressemitteilung
|
Autor
|
Thema: EPLAN script does not work if space present in CLI argument value (1363 / mal gelesen)
|
blitzkreig Mitglied Engineer

 Beiträge: 20 Registriert: 03.09.2018
|
erstellt am: 21. Jan. 2019 05:27 <-- editieren / zitieren --> Unities abgeben:         
Hi, When passing arguments through command line to EPLAN, if there is a space character in the value, then the quotes("") used to identify parameters are not correctly. This leads to missing parameters when EPLAN is being run, which causes script to fail. Example: "C:\Program Files\EPLAN\Electric P8\2.7.3\Bin\W3u.exe" ExecuteScript /ScriptFile:"script.cs" /path:"test.elk" /system:"Test system" /subsystem:"test" EPLAN error when I run it: Expected parameter 'subsystem' is missing. And the console output: Code: "C:\Program Files\EPLAN\Electric P8\2.7.3\Bin\W3u.exe" ExecuteScript /ScriptFile:"script.cs" /path:test.elk /system:"Test system /subsystem:test"
You can see Eplan automatically removes the quote in between, so subsystem parameter is inside system parameter quote, which is why it is missing. If I remove the space in the value passed to 'system' parameter as shown below, then script works: Code: "C:\Program Files\EPLAN\Electric P8\2.7.3\Bin\W3u.exe" ExecuteScript /ScriptFile:"script.cs" /path:"test.elk" /system:"Test_system" /subsystem:"test"
Console output: Code: "C:\Program Files\EPLAN\Electric P8\2.7.3\Bin\W3u.exe" ExecuteScript /ScriptFile:"script.cs" /path:test.elk /system:Test system /subsystem:test
So how do I fix this problems? Because of this issue, none of my parameter values can have spaces in them, even though I use double quotes to separate them.. Thanks! Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP |
cad_hans Ehrenmitglied V.I.P. h.c. Techn. Angestellter
     
 Beiträge: 2295 Registriert: 25.08.2003 ruplan4.70 eplan5.x P8 V1.9 bis V2.7
|
erstellt am: 21. Jan. 2019 07:38 <-- editieren / zitieren --> Unities abgeben:          Nur für blitzkreig
hello, why is it a Problem not to have spaces in your values? i personally do not like spaces in names or values. i always try to use some other characters to seperate the names if it has to be. ------------------ ruplan4.70 eplan5.x P8 V1.9 bis V2.7 Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP |
blitzkreig Mitglied Engineer

 Beiträge: 20 Registriert: 03.09.2018
|
erstellt am: 21. Jan. 2019 07:52 <-- editieren / zitieren --> Unities abgeben:         
Zitat: Original erstellt von cad_hans: hello,why is it a Problem not to have spaces in your values? i personally do not like spaces in names or values. i always try to use some other characters to seperate the names if it has to be.
Hi, Sometimes customer will need spaces in some of these values. Also, sometimes I have to pass path of project as parameter, which usually always has a space in them, which cannot be avoided.
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP |
Maniax112 Mitglied Anlagenplaner Maschinenbau

 Beiträge: 23 Registriert: 23.07.2011 EPLAN P8 2.5 HF1
|
erstellt am: 17. Sep. 2019 09:24 <-- editieren / zitieren --> Unities abgeben:          Nur für blitzkreig
|

| Dipl.-Ing./M./BA/Techniker Elektro-Konstrukteur (m/w/d) | Die Hinterkopf GmbH ist ein inhabergeführtes, mittelständisches Unternehmen in zweiter Generation mit Sitz in Eislingen/Fils bei Göppingen (BaWü), das 1962 gegründet wurde. Das Familienunternehmen hat es bei der Entwicklung und Herstellung von großen Maschinen und Produktionslinien zur Herstellung und Dekoration zylindrischer Hohlkörper zur Weltmarkt- und Technologieführerschaft geschafft.... | Anzeige ansehen | Feste Anstellung |
|
pxecad Mitglied
 
 Beiträge: 260 Registriert: 13.02.2015 - - - - - - - - - - - - - - - - - - - - - Electric P8 2024 U1 Pro Panel 2024 U1 EEC Professional 2023 (Web EEC) - - - - - - - - - - - - - - - - - - - -
|
erstellt am: 17. Sep. 2019 09:48 <-- editieren / zitieren --> Unities abgeben:          Nur für blitzkreig
Hello, i can not find any errors using EPLAN 2.7 HF7 and Windows 10 1803. I just made a little script with your input parameters: public class Script { [Start] public void Test(string path, string system, string subsystem) { MessageBox.Show("Script works with parameter:" + "\npath:" + path + "\nsystem:" + system + "\nsubsystem:" + subsystem); } } And started it with: "E:\PROGRAMMEx64\Electric P8\2.7.3\Bin\W3u.exe" ExecuteScript /ScriptFile:"D:\P8_Script_1_Message_one_row_var.cs" /path:test.elk /system:"Test system With Space" /subsystem:"test" Looks quite goood, with output in EPLAN Pop Up. See picture. I think your qoutes are not at the right position. [Diese Nachricht wurde von pxecad am 18. Sep. 2019 editiert.] Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP |