Hello GMICs,
How to deal with variables containing a \ .
The reason for doing so is because I’d like to output my Images on a subdirectory of the current Image
Actualy I came accross by doing it this way - but is it correct?
imgPath={0,f} # will contain an Windows-Path with several \ …
pTokn=${-struncase\ “out\”} # how to define a variable, that contains only ONE \ at the end… - correct way?
imgPN=$imgPath$pTokn #this can be used to concatenate - correct way?
… or did I mess up something in the documentation?
Thanks a lot
Thomas
Why not
pTokn=${-struncase\ "out"}\\
A backslash in G’MIC means the next character is ‘escaped’, so a double backslash means you want a single backslash.
Does it work like this ?
Hello David,
… because… I do not really understand how you got to work that. On my windows-pc it doesn’t work, will add two \…
What I’ve tried:
test:
file=$1
-input file
imgPath={0,f} #contains a correct formated windows path
imgName={0,b}
imgExte={-struncase\ {0,x}} #uncase not realy nessecary in this example… -if {[’$imgExte’]==‘jpg’}
now lets try to add the name of the subfolder…
pTokn1={-struncase\ "out"}\\\ # doesn't work - will add two \\ , well, Windows will acceppt the path this way but...
pTokn2={-struncase\ “out\”} # does work - will add one \
pTokn3=out\\ # doesn’t work - same as pTokn1 (by the way: do not use a single \ at the end of a line…)
pTokn4=out\test # strange - a single \ in the middle will be added…
pTokn5=out\$pTokn4 # but cannot be combined with a variable? (double \ or $ escaped…)
-quit
Well - maybe you see what I’m doing wrong - otherwise I will go on with pTokn2… 
Thank you
Thomas
Ah yes, thomas you are right, using \\ wont replace them by a single \. There must be a good reason for that, I don’t remeber it yet though 
Another solution is this :
pTokn=out{`92`}foo
Also, I guess you could use simple slashes as well, as Windows now accepts them into path name since a while.
Hello David,
OK then - I`ll go on as you suggested! 
Thomas
PS: there is some chocolate! 
Thanks Thomas, I appreciate it ! It’s a bit more than one hot chocolate tough, I think I’ll have enough for the next three months 