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
austinspencer
Level II

How to get the path to the current project file?

If I have a script within a project (or perhaps a reference to the project in a script outside of the project), how to do I get the file path to where the project is saved on disk?  I'm interested in doing this with JSL, not interactively.

12 REPLIES 12
Crew
Level I

Re: How to get the path to the current project file?

// I had a similar problem with removing the file name from the file path 
 
Names Default To Here( 1 );
dt = Current Data Table();
 
current_file = dt << Get Path();
current_directory = Word([1 -2], current_file, "\");
// return the full string ([1 -1]), except for the last word ([1 -2])
 
data = Pick File(
"Select Data Files",
current_directory,
{"Excel|csv","JMP Files|jmp;jsl;jrn","All Files|*"},
1,
0,
"", multiple
);

Re: How to get the path to the current project file?

It turns out that message isn't available until (the future) JMP 18.2. 

 

In fact, I appears that I actually added it earlier this year in response to this question, but incorrectly marked it as having existing since JMP 14. Then I somehow forgot that I had done so, such that on reencountering this thread a few months later, I went looking for a solution and found the one I had recently created (but thought it was much older than it was). 

 

Sorry about that.

austinspencer
Level II

Re: How to get the path to the current project file?

Ah, I love the story.  No worries. I can only laugh because it sounds exactly like the sort of thing I would do.  The number of times I've written a function to solve a problem only to find I had made the exact same thing under a different name 6 months prior...

 

Anyway, I'm glad to hear the functionality is on the way!