View Full Version : Variables = to file paths

02 February 2006, 10:45 PM
Newb question. How can i set the following variable = to a directory path?

ToDir = ("Z:\image-dump\items\")

Everytime I try to first this, everything breaks :(

What do I do?

02 February 2006, 11:26 PM
Whenever you need to use a special character in a string, you need to precede it with an escape character, the backslash.

A file path would then look like this: "z:\\foo\\bar\\blarg\\". The first backslash tells the intepreter to expect a special character and then you follow it with the special character. Quotes are done in the same way: "this is a \"string\" with quotes".

A tab is \t, a newline is \n, etc.

For file paths in MaxScript you can use the forward slash instead: "z:/foo/bar/blarg" but this isn't something I like to do. If you are going to be passing the paths out to something external like a DOSCommand, then you want the backslashes in there.

Hope that helps.

02 February 2006, 11:55 PM
That is exactly what I needed to know.

Thank you very much.


CGTalk Moderation
02 February 2006, 11:55 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.