View Full Version : how to set working directory

09-19-2007, 09:56 PM

is there a way to set the working directory when running a script?

my Modeler script opens a directory and loads an object; currently I have the directory location hardcoded in the script, but that is not versatile enough;

any thoughts?


09-27-2007, 01:15 AM
assign a variable to the control instead of typing out the directory.

you can also use getdir() to get default directories. for example:

contentDir = getdir("Content");
objectDir = getdir("Objects");
scenesDir = getdir("Scenes");

see lscript docs for more details and more options.

09-27-2007, 09:58 AM
faulknermano, thanks for responding;

the getdir(...) only returns the currently set directory of ... ; I am wanting to set the working directory during runtime of a script, as the script needs to know what directory to open to find the relevent .lwo's;


09-29-2007, 11:13 AM
i'm not quite sure i follow. a working directory, if i understand you correctly, can be set by assigning a string to variable and using that for whatever you want. if you want user input, then you can use various script controls to have the user enter the working directory. these controls can be:

ctlstring (manual typing of path)

i use ctlfilename to be able to browse to a file. but i use split() to only retrieve the path from the full path filename. then i store this into a variable and use this as the basis for everything.

did i understand you correctly? if not you can post an example of exactly how you want the script to behave. pardon me if i'm a bit thick. :)

10-06-2007, 11:54 AM
I think the question is what directory it starts in browsing wise.

Which is the content directory in my experience (if that indeed is the question).