PDA

View Full Version : openFile problems...?


Baothebuff
08-22-2007, 07:48 PM
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

magicm
08-22-2007, 10:05 PM
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

Baothebuff
08-23-2007, 03:20 PM
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. :sad:

ypuech
08-23-2007, 03:31 PM
Why do you use execute over the stream value ?

Baothebuff
08-23-2007, 04:40 PM
Why do you use execute over the stream value ?

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.

ypuech
08-23-2007, 04:51 PM
Ok. I've tested but had no error. Can you put your code ?

Baothebuff
08-23-2007, 05:16 PM
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. :thumbsup:

CGTalk Moderation
08-23-2007, 05:16 PM
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.