PDA

View Full Version : file open lscript examples?



Stooch
11-14-2008, 06:04 PM
Id like to create some production tools that open up folders to very specific locations based on my scene file name.

are there any examples of file open dialog scripts or commands? lscript documentaion is very short on examples.

faulknermano
11-17-2008, 06:36 PM
dodgy's lscript docs are useful because of the quick links to topics.

at any rate, as to your questions:

to open up a file dialog box:


getfile([title],[mask],[dir],[reqtype]);

title -- String; dialogue box title
mask -- String; file mask to use, which can include * wildcards
dir -- String; start directory
reqtype -- Boolean; 0 = save, 1= open




defaultDir = "d:\\projects";
fn = getfile("Open file","*.txt",defaultDir,1);



but in direct answer to what you want to do, i'd first get the scene file name:



scn = Scene().filename;


and then find your location by however you intend. once you get the final string path (let's assume it is the variable finalPath) you can navigate to it by feeding it:



cmd = "explorer /n," + string("\"",finalPath,"\"");
system(cmd);

Stooch
11-30-2008, 02:46 AM
wow thats badass. thanks alot.

zapper1998
11-30-2008, 10:11 AM
def notepaded it also...

Matt
12-01-2008, 06:56 AM
And to get a folder only:

myfolderpath = getfolder("Please Choose a Folder");

Stooch
12-02-2008, 08:28 PM
thanks matt. i might be popping here for some more questions, really appreciate the help.