[Closed] Syntax help needed – using " in maxscript
Hi All
I´m quite new to maxscripting has gone head first into a quite large script – lerning by doing style and maybe because of my approach now im a bit stuck now:
I have a automatic system for setting up a lot of similar single object renders of my scene containing 200+ objects. Now i want the output filename to be the same af the objectname in max and therefore I have programmed maxscript to create a batch file that rename all of the renders… but one little thing is missing. The syntax in good old dos for renaming files dosn’t allow any spaces except for the one seperating the two filenames and all my object are called: ‘something – like – 5555.555’ so that is no good. But when include one ” at each end of the statement the rename completes flawless.
Is there any way that you can add ” in maxscript? If do this: outputstring= “””+name+” – “+number+””” if of cource fails. Is there a solution?
If not is it posible to trim all spaces in my outputstring?
Thanks
It fails because max is looking for a string. The ” character is a special character for max and is used to delimitate a string. If you want to use it inside a string you have to put the \ in front of it. So your code should look like this:
outputstring= "\"" + name + " - " + number + "\""
If you’re using max 2008 or higher (or have the AVG extension installed), you can also use the following to replace strings:
substituteString <source_string> <from_string> <to_string>
Cheers,
Martijn