cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
vibhu7668
Level I

Storing folder directory from user prompted file selection

This code not working. Please suggest how to modify it

 

file_name = Pick File ( "Select a file to open" ); // this line of code is working
folder_path = file_name << Get Directory() ; // this line of code not working.

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Storing folder directory from user prompted file selection

try


folder_path = substr(file_name, 1, length( file_name)- 
	length(word(-1,file_name,"\/")))
Jim

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: Storing folder directory from user prompted file selection

try


folder_path = substr(file_name, 1, length( file_name)- 
	length(word(-1,file_name,"\/")))
Jim
vibhu7668
Level I

Re: Storing folder directory from user prompted file selection

That worked.

 

Thanks.

jthi
Super User

Re: Storing folder directory from user prompted file selection

I like doing this using Word() with matrix to define the range of return (Word supports negative index)

Names Default To Here(1);

filepath = Convert File Path("$SAMPLE_DATA/Big Class.jmp", windows);

directory = Word([1 -2], filepath, "/\") || "\";

Show(filepath, directory);

If you don't need to have "/" or "\" at the end of your folder path, you can drop the || "\" part.

-Jarmo