cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar

Get pathname of current script

I would like a command to return the pathname of the JSL script.  For example, if I run a script "/Users/John_Doe/Documents/JMP/JMP Scripts/myscript.jsl", and I would like to have a command like this inside the script:

 

thispath = Get Current Script Path();   
Show(thispath);

And I would like this to return: "/Users/John_Doe/Documents/JMP/JMP Scripts/myscript.jsl"

 

The reason for this request:

I have a "common functions.jsl" script that many of my scripts call using "Include".  It contains many frequently used user functions that I don't want to copy into each new script I write.  I also like to share my scripts with others in my group, along with "common functions.jsl".  I can require that my group members place common functions.jsl in the same place relative to the JSL calling it (e.g. the same folder, or parent folder), but I can't control what the overall path names will be.  If I had the path name of the calling script, I could easily use that to figure out where "common function.jsl" is (e.g. "/Users/John_Doe/Documents/JMP/JMP Scripts/common function.jsl").

 

I cannot use Get Default Directory().  I've found this command returns only the path of the most recent file opened using the Open File dialog.  This works if the user opens the script and immediately runs it.  The problem is if the user opens another script after opening "myscript.jsl", but then tries to run "myscript.jsl".  It this case Get Default Directory() will return the path of the other script, not "myscript.jsl".  Also, Get Default Directory() does not get updated if a script is opened from the Recent Files list.  

 

Any suggestions, or is this something that doesn't exist yet?  Thanks for your help.

3 Comments
Ryan_Gilmore
Community Manager
Status changed to: Archived
We are archiving this request. If this is still important please comment with additional details and we will reopen. Thank you!
xxvvcczz
Level III

I would like this feature did anything ever happen with this?

I've been stuck with:

curdir = Substr(Get Default Directory(), 2, 999);
hogi
Level XII
Convert File Path( "", windows )