|
Hello everyone!
In a need to use this code:
file = (createfile "C:\Users\Relja\Desktop\\filename.txt") format "mystring" to:file
I’ve found out that it’s not working in 3ds Max 2012. Works fine in 2010, but in 2012, compiler says “OK” but nothing gets formatted to the file.
I’ve looked under the MAXScript Help on the web, but they say nothing about changing this command.
If anyone knows a solution, I would appreciate if you’d share.
Thanks!
|
|
|
|
Moved from Max2012 - you’ll get better responses by posting in the most appropriate forum for the question.
First off - be careful with variable names, avoid any names which may conflict with built-in variables/functions.
Second - you should be testing the result of the createFile to see if it worked.
Finally, backslashes in filenames have always been problematic - sometimes they work and sometimes they don’t. Avoid such issues by either using 2 of them, or by using a single forward slash.
myFile = createfile "C:/Users/Relja/Desktop/filename.txt" if myFile != undefined then
format "mystring" to:myFile else
messageBox "Error: File open failed"
Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.
|
|
|
|
there was change to maxscript filestreams in max 2012. the stream isn’t actually written until the file is closed. steve’s code is best practice, but you will also need to execute a close command before trying to look at the file:
myFile = createfile "C:/Users/Relja/Desktop/filename.txt" if myFile != undefined then (
format "mystring" to:myFile
close myFile )
greg
|
|
|