cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP 19 is here! See the new features at jmp.com/new.
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
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.

14 REPLIES 14
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!

cisco_bakro
Level I

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

Hi now we have JMP 18.2.

where can it be queried?

Craige_Hales
Super User

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

In JSL.

path = this project() << project file path();
show(path);

Tested in 19EA.

Craige

Recommended Articles