PDA

View Full Version : the \t problem


Hobbs
04-26-2007, 07:33 PM
I think i saw a solution to this before, but don't really know how to look for it here in the forum in terms of subject matter.

Does anyone have a solution to the \t and other various string entries

example

C:\Documents and Settings\DanN\Desktop\test.dat

will be read as desktop est.dat

i know you can add double \\ to solve this, but does someone have a function or a line of code that does this for you?

Thanks

Bobo
04-26-2007, 09:10 PM
Another solution is to use regular / slashes which are equivalent to \\ in MAXScript.
Also NOTE that the \t problem only occurs when EXECUTING the script, either via execute(), File>Evaluate All (Ctrl+E), readValue() or fileIn(). Otherwise, single backslashes are not a problem, thus entering c:\temp\test\ in an edittext field does NOT turn \t into tabs, same with reading strings from an ASCII file using readLine() or via getIniSetting (as long as you don't execute the value).

Hobbs
04-26-2007, 09:51 PM
I forgot about using /...thanks

I have had issues when using getopenfilename, and then transfering that string to getMaxFileObjects....actually with most of the "get" commands, i am having this issue...maybe i have been doing it wrong, but the only solution i came up with was to call one inside the other

so for exampe..

getMAXFileObjectNames(New_file = getopenFileName)

but this isn't always convient

so to swap out back slashes would have i have to call that finds them in a string and then switches them with the other type, or am not using these calls effectively, or am i just wrong in general :).

Thanks

Bobo
04-26-2007, 10:30 PM
Storing path values in variables should NOT cause any troubles with backslashes.
You should be able to get the file name, pass it to any other methods, put it in UI controls, get it back from there, read is as a string from text files and so on.

There must be something more that you are doing to the path name related to evaluating the string as a MAXScript value as opposed to just using it as a string value.
If you print the string to the Listener and then try to use it or if you type it in a script, you HAVE to either double the backslashes or turn them to forward slashes.

MoonDoggie
04-26-2007, 11:22 PM
fn returnForwardSlashPath thePath =
(
local newPath = thePath

if (classOf thePath) == String then (
for i = 1 to thePath.count do (
if (substring thePath i 1) == "\\" then
newPath[i] = "/"
)
)
return newPath
)

EricDLegare
04-27-2007, 01:32 AM
Storing path values in variables should NOT cause any troubles with backslashes.
You should be able to get the file name, pass it to any other methods, put it in UI controls, get it back from there, read is as a string from text files and so on.

There must be something more that you are doing to the path name related to evaluating the string as a MAXScript value as opposed to just using it as a string value.
If you print the string to the Listener and then try to use it or if you type it in a script, you HAVE to either double the backslashes or turn them to forward slashes.

Bobo, youre tha best :P and your DVD "The Matrix Explained" is Awesome :deal:

CGTalk Moderation
04-27-2007, 01:32 AM
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.