Rule 1. Backslash is the escape character; always escape quotes; only escape
backslashes if they precede a quote.
-D "val2="text""
You only need to include a semi-colon if you have multiple statements in the
one -D argument.
-D "val2="text"; val1=[10,20]"
Admin - PM me if you need anything, or if I've done something stupid...
Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
View this message in context: http://forum.openscad.org/Problem-passing-in-strings-to-openscad-from-dos-prompt-tp16799p16804.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Forget it.
This is UNIX rule, not DOS/Wondows.
From: Discuss [discuss-bounces@lists.openscad.org] on behalf of MichaelAtOz [oz.at.michael@gmail.com]
Sent: 30 March 2016 01:34
To: discuss@lists.openscad.org
Subject: Re: [OpenSCAD] Problem passing in strings to openscad from dos prompt
Rule 1. Backslash is the escape character; always escape quotes; only escape
backslashes if they precede a quote.
-D "val2="text""
You only need to include a semi-colon if you have multiple statements in the
one -D argument.
-D "val2="text"; val1=[10,20]"
Admin - PM me if you need anything, or if I've done something stupid...
Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
View this message in context: http://forum.openscad.org/Problem-passing-in-strings-to-openscad-from-dos-prompt-tp16799p16804.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
@MichaelAtOz you are a saint!
openscad -o Out.stl -D* "p="string"" *String_test.scad
result =
ECHO: "string"
Current top level object is empty. <-- This is correct. The test was just an
echo statment.
Thanks for fixing my implementation problem, any chance you could elaborate
a bit about why the backslashes before the quotes?
-Matt
--
View this message in context: http://forum.openscad.org/Problem-passing-in-strings-to-openscad-from-dos-prompt-tp16799p16819.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
mmaggio wrote
any chance you could elaborate a bit about why the backslashes before the
quotes?
The backslash is an escape character
https://en.wikipedia.org/wiki/Escape_character within a double quoted
string, so /" means treat the following character as a character rather than
as a string delimiter. If you actually wanted a backslash in a quoted string
would would need "a single backslash is //". It can also be used for other
special characters.
This area can get quite complicated, see here
http://stackoverflow.com/questions/562038/escaping-double-quotes-in-batch-script
for lots of info.
I did lots of testing with OpenSCAD command line, and found this solution to
be best.
Admin - PM me if you need anything, or if I've done something stupid...
Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
View this message in context: http://forum.openscad.org/Problem-passing-in-strings-to-openscad-from-dos-prompt-tp16799p16834.html
Sent from the OpenSCAD mailing list archive at Nabble.com.