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.
I struggled with this too. Even if it was possible, it would not work for what I wanted to do because the files in a project are unpacked on demand, not when the project is first opened. My use case was needing a filepath for a resource in the project...that would go to an external program. I wound up using loadtextfile(proj file name)/savetextfile($temp/name) and sending the temp file name.
That's a good question, and probably one I should have answered in the original question. When working on a project, sometimes it would be helpful to be able to quickly copy the path to the project to either open the containing folder to view other associated files or to store the link in my notes or send to a coworker. This is a relatively common and useful feature found in many code editors and office suite software. Of course you can just browse to the file through other means, but it's a common enough task for me that it's handy to have a quick method that doesn't require me to mentally parse my file organization structure each time. Thanks for your time!
@aaron_andersen , @julian - He's right; I've resorted to using file->SaveAs to discover the path in the past. The home window's recent file list is better, offering both copy path and open containing window. Maybe those could also be exposed on data table, script, and project windows as well. The system popup off the title bar might be an alternative to the file menu.
I think projects may be a special case from JSL; data tables and scripts can already get their path.
I do not find a function specific to a JMP project. There is no path variable for projects either. You are free to save a project anywhere you like. It is a kind of JMP file, so when you open or save a project, JMP will start with the last directory. You can get this information using the Get Default Directory() function.
Thanks for looking into this. I've had luck using Get Default Directory() in bare scripts, but when a script is saved in a project, it just returns the path inside the project file rather than where the project is stored: