extracting the directory of a jmp file in JSLHi all,
I have managed to do what I want in a convoluted way (using word and character manipulations) but I feel there must be an easier way to do this. All I want is to extract the directory of a file I just selected using the Pick File function in JSL so that the next time, it starts from that directory. Any suggestions??
Thanks, Yves
Advanced Statistical ModelingAutomation and ScriptingData AccessQuality and Process EngineeringRe: extracting the directory of a jmp file in JSLYes this works great! It is close (but better) than what I had come up with. I just thought there should be a built-in function to extract the location (the directory path) of a file. Many thanks @txnelson !
Regards, Yves
Re: extracting the directory of a jmp file in JSLTake a look at my script below, and tell me if I am getting closer to what you want.
Names Default To Here( 1 );
theDirectory = "";
xx = Pick File( "Pick a File", theDirectory );
theDirectory = Substr( xx, 1, Length( xx ) - Length( Word( -1, xx, "\/" ) ) - 1 );
// now this Pick File will go to the directory that the file from the last
// Pick File was selected from
yy = Pick File( "Pick a File", theDirectory );
// If you want this Pick File to span across different scripts, then it would be a simple
// matter to save the directory in a specific namespace and get the
// directory location from a variable saved in that namespace.
// If you want to have the Pick File directory available from JMP session to JMP session
// then what I have used in the past, is to simply save the character string for the
// directory to a .txt file, using Save Text File() and Load Text File() to make the directory
// persistant
Re: extracting the directory of a jmp file in JSLSorry I pressed the wrong button!!! Unfortunately, this is not a solution @txnelson . This only lists the files of a known directory. I want to browse to find the file I want and once I have chosen it, I want to save the directory so that next time I want to browse , it starts at that previous directory.
Cheers, Yves
Re: extracting the directory of a jmp file in JSLCheck out the Files in Directory() function in the Scripting Index
