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?
Solved! Go to Solution.
Solved by Swordslayer. Go to Solution.
You should always use #userScripts for that, instead.
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
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).
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