Asked
— Edited
Resolved by Rich!
example
This is ok $BasePath = "G:"
but this gives error
$BasePath = "G:/"
it is because of the / , im asuming is being used as an escape char in Ez-Script.
is there a way to escape this?
I don't get an error when I run a script with your example in it ... $BasePath = "G:/" .... Do you have the full script to post?
Two things;
What is this for? It may be that there is a better/different way of doing it.
yes sorry it is the " that give the error
I can code around it. Being familiar with many languages but not so familiar with EZ-Script , most languages have and escape code around this for instand !" would work in some languages or \" to produce single back slash
If you add a trailing space it will save the variable however that will lead to problems with any commands that use the variable.
Again, what's it for? That may help find a solution. I assume some kind of file interaction but would need to know more.
If the intention is to have a path and multiple different $file variables you can always use $basepath as "G:" and have the $file variables (or text) begin with the \
i.e.
That is the work around i am currently using Rich. I was just wanting to avoid putting the \ in front of all the file names when i could have had it once in the base path decoration.
This is they script and its use.
Print("Setting up Variables") $BasePath = "G:" $OutputDir = $BasePath + "\DataOut" $InputDir = $BasePath + "\DataIn" $Weatherinput = $InputDir + "\wather.rss" $X10SystemInput = $InputDir + "\HomeX10.rss" $TaskListInput = $inputDir + "\Tasklist.rss" Print("Var Setup Completed")
Unless you had each file start with a preceding name or letter
The filenames would actually be Robot-log.txt and Robot-data.txt
Not ideal but unless I've missed it a variable cannot end with a \
Good catch Rich... my script ran because it had no context... no other commands associated with it....
you could try to use \ instead. I am not at a machine running ARC or i would test it for you.
$BasePath = "G:\"
\ is an escape code in C#. \ should give you \
This
$BasePath = "G:\"
Also resulted in error.
Thanks guys.
No problem. I guess the outcome is that this is a limitation in EZ-Script and an alternative method is needed.
P.S. Thanks for the credit, you're number 250
maybe it is messing up because you misspelled weather in wather.rss
...or it's a typo when he wrote his post (#6)....
ya the wather weather was not relevant. The out come was just the EZ Script does not allow the \ character at the end of a string.
this can work to remove the extra space left at the end if you really wanted the \ at the end of the first variable
have any of you guys figured out how to print a forward bracket? i.e. "(" the backslash in front works for printing """ but not the (