Community
3ds Max Programming
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max SDK, Maxscript and Python topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

3dsmax on Windows 10 fails to write files via maxscript

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
giuseppetonello
2889 Views, 5 Replies

3dsmax on Windows 10 fails to write files via maxscript

 

 

TheFileName = ((getdir #scripts) + "\\MyScripts\\" + "Foo.ini")

ren_ini = createFile TheFileName

This gives me a runtime error: cannot create c:\bla\bla\bla\TheFileName.ini

 

I've already tried to run Max in admin mode and the problem remains.

 

Ideas?

Joey
5 REPLIES 5
Message 3 of 6

SwordSlayer, I need to write in the scripts directory, though. Is it possible?

These commands actually work, they simply return different paths

getdir #scripts
getdir #userscripts

 

Joey
Message 4 of 6

Well, not that it would be impossible but I don't want to encourage that, you will be bitten by it in the end sooner or later. I simply can't see a reason why it would make a difference to make your custom scripts folder and work with in the userscripts folder vs. the system folder (which is supposed to hold only the default scripts).

Message 5 of 6

Ok, this is getting weird. Max won't let me write in the #userscripts directory, too. I'm getting the same error: filestream cannot create file.
Joey
Message 6 of 6

Does the folder exist? If not or if it's not guaranteed, do this:

 

 

folder = getDir #userScripts + @"\MyScripts\"
if NOT doesFileExist folder OR NOT getFileAttribute folder #directory do makeDir folder

TheFileName = folder + "Foo.ini"
ren_ini = createFile TheFileName

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report