Notifications
Clear all

[Closed] openFile problems…?

I have a call to a file to save preferences settings such as rollouts rolledUp, parameters, etc…:

fstream = openFile "c:\pref.ini"

and I’m using:

execute fstream

to read in the values. It works fine but in the max sesion but everytime i restart max, it appears as though it can’t read the file because the parameters can’t initialize. What’s going on?

Also, for some reason it works when I’m in the maxscript editor and using ctrl-E but when I use “run script” from the maxscript ultilities panel, it says “unknow property: “open” in undefined”

that’s wierd to me. Any help would be greatly appreciated. thanks

6 Replies

Make sure you call close fstream when you’re done with reading or writing. Leaving the file open makes it inaccessible for other file operations.

Cheers,
Martijn

I do have a close fStream after every open i do. :shrug:

still doesn’t work. It only works when I do a ctrl-E from the editor but not when I run. 🙁

Why do you use execute over the stream value ?

1 Reply
(@baothebuff)
Joined: 2 years ago

Posts: 0

because I have varibles written in the file such as:


startFrame = 25 
endFrame = 100 
etc...

that I want to be initialized when the script starts.

Ok. I’ve tested but had no error. Can you put your code ?

Haha, nevermind, the problem was not with openFile but with .open in the rollouts. Because maxscript didn’t say where the error happened, I got confused. I figured this out when I started copying portions of my script to a new file and kept running it until it errored out.

Thanks everyone who helped out. I appreciated it.