cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
mjoner
Level VI

JSL Identify Path of the Currently Running Script

When running a script (either from the script window or by triggering it from the add-in) I would like to be able to either (1) get at the location of the directory that the script window is in or (2) get the id of the add-in that contains the script. JMP knows this because it had to open the script to start executing this. Is there a way to do this?

I know I can do this in an add-in context by using $ADDIN_HOME(id). The issue here is I have a common include that I am packaging in multiple add-ins, and I'd rather not have to change the file for each different add-in. I can see myself accidentally making a copy of the common include from add-in #1 to add-in #2 and forgetting to change the id in the include so that it uses the right path in add-in #2.

10 REPLIES 10

Re: JSL Identify Path of the Currently Running Script

I like Jeff's solution. But there is a dedicated utility function, too, for this purpose. Here is an example:

 

Convert File Path( "$HOME", Windows );

 

It can do more than change the format from POSIX to Windows. See Help > Scripting Index > Functions > POSIX.