cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-49539%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EChemin%20d'identification%20JSL%20du%20script%20en%20cours%20d'ex%C3%A9cution%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-49539%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3ELors%20de%20l'ex%C3%A9cution%20d'un%20script%20(soit%20%C3%A0%20partir%20de%20la%20fen%C3%AAtre%20de%20script%2C%20soit%20en%20le%20d%C3%A9clenchant%20%C3%A0%20partir%20du%20compl%C3%A9ment)%2C%20j'aimerais%20pouvoir%20(1)%20obtenir%20l'emplacement%20du%20r%C3%A9pertoire%20dans%20lequel%20se%20trouve%20la%20fen%C3%AAtre%20de%20script%20ou%20(2)%20obtenir%20le%20id%20du%20compl%C3%A9ment%20qui%20contient%20le%20script.%20JMP%20le%20sait%20car%20il%20a%20d%C3%BB%20ouvrir%20le%20script%20pour%20commencer%20%C3%A0%20l'ex%C3%A9cuter.%20Y%20a-t-il%20un%20moyen%20de%20faire%20cela%3F%3C%2FP%3E%3CP%3EJe%20sais%20que%20je%20peux%20le%20faire%20dans%20un%20contexte%20de%20compl%C3%A9ment%20en%20utilisant%20%24ADDIN_HOME(id).%20Le%20probl%C3%A8me%20ici%20est%20que%20j'ai%20une%20inclusion%20commune%20que%20j'emballe%20dans%20plusieurs%20compl%C3%A9ments%2C%20et%20je%20pr%C3%A9f%C3%A8re%20ne%20pas%20avoir%20%C3%A0%20modifier%20le%20fichier%20pour%20chaque%20compl%C3%A9ment%20diff%C3%A9rent.%20Je%20peux%20me%20voir%20faire%20accidentellement%20une%20copie%20de%20l'inclusion%20commune%20du%20compl%C3%A9ment%20n%C2%B01%20au%20compl%C3%A9ment%20n%C2%B02%20et%20oublier%20de%20modifier%20l'identifiant%20dans%20l'inclusion%20afin%20qu'il%20utilise%20le%20bon%20chemin%20dans%20le%20compl%C3%A9ment%20n%C2%B02.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-366774%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20JSL%20identifie%20le%20chemin%20du%20script%20en%20cours%20d'ex%C3%A9cution%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-366774%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EIl%20existe%20%C3%A9galement%20une%20fonction%20int%C3%A9gr%C3%A9e%20pour%20traduire%20entre%20le%20d%C3%A9limiteur%20de%20chemin%20POSIX%20et%20Windows%26nbsp%3B%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22convert.PNG%22%20style%3D%22width%3A%20804px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22convert.PNG%22%20style%3D%22width%3A%20804px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22convert.PNG%22%20style%3D%22width%3A%20804px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F31146i849BD3AA734E8C49%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22convert.PNG%22%20alt%3D%22convert.PNG%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-237099%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20JSL%20identifie%20le%20chemin%20du%20script%20en%20cours%20d'ex%C3%A9cution%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-237099%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EMerci%20Jeff%2C%20c'est%20super%20!%3CBR%20%2F%3E%3CBR%20%2F%3E%20J'ai%20cependant%20trouv%C3%A9%20une%20autre%20solution%26nbsp%3B%3A%20j'ai%20enregistr%C3%A9%20mon%20script%20dans%20le%20m%C3%AAme%20r%C3%A9pertoire%20que%20la%20table%20de%20donn%C3%A9es%20actuelle%2C%20puis%20j'obtiens%20le%20chemin%20de%20ma%20table%20de%20donn%C3%A9es%26nbsp%3B%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Edt%20%3D%20Current%20Data%20Table()%3B%0Apath%20%3D%20dt%26lt%3B%26lt%3B%20getpath%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%3CBR%20%2F%3ELe%20%22chemin%22%20r%C3%A9sultant%20est%20mon%20chemin%20de%20r%C3%A9pertoire%20avec%20des%20barres%20obliques%20inverses%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-236276%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20JSL%20identifie%20le%20chemin%20du%20script%20en%20cours%20d'ex%C3%A9cution%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-236276%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EJ'aime%20la%20solution%20de%20Jeff.%20Mais%20il%20existe%20%C3%A9galement%20une%20fonction%20utilitaire%20d%C3%A9di%C3%A9e%20%C3%A0%20cet%20effet.%20Voici%20un%20exemple%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EConvert%20File%20Path(%20%22%24HOME%22%2C%20Windows%20)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIl%20peut%20faire%20plus%20que%20changer%20le%20format%20de%20POSIX%20%C3%A0%20Windows.%20Voir%20Aide%20%26gt%3B%20Index%20des%20scripts%20%26gt%3B%20Fonctions%20%26gt%3B%20POSIX.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-236266%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20JSL%20identifie%20le%20chemin%20du%20script%20en%20cours%20d'ex%C3%A9cution%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-236266%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EJMP%20et%20JSL%20ne%20se%20soucient%20pas%20de%20l'orientation%20des%20barres%20obliques.%20Ils%20fonctionneront%20de%20toute%20fa%C3%A7on.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESi%20vous%20devez%20utiliser%20la%20cha%C3%AEne%20de%20chemin%20en%20dehors%20de%20JMP%2C%20vous%20pouvez%20utiliser%3CA%20href%3D%22https%3A%2F%2Fwww.jmp.com%2Fsupport%2Fhelp%2F14-2%2Fsubstitute-and-substitute-into.shtml%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3E%20Remplacer%20dans()%26nbsp%3B%3A%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Efoo%3D%22c%3A%2Fmy%20directory%2Fmy%20directory%2Fmy%20directory%22%3B%0A%0Asubstitute%20into(foo%2C%20%22%2F%22%2C%20%22%5C%22)%3B%0A%0Ashow(foo)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-236236%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20JSL%20identifie%20le%20chemin%20du%20script%20en%20cours%20d'ex%C3%A9cution%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-236236%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3ELa%20solution%20ne%20fonctionne%20pas%20pour%20moi%2C%20le%20chemin%20r%C3%A9sultant%20est%20avec%20des%20barres%20obliques%20%2F%2C%20j'en%20ai%20besoin%20avec%20une%20barre%20oblique%20inverse%20%5C.%20Est-ce%20que%20quelqu'un%20conna%C3%AEt%20une%20solution%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-49577%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20JSL%20identifie%20le%20chemin%20du%20script%20en%20cours%20d'ex%C3%A9cution%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-49577%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EObtenir%20le%20r%C3%A9pertoire%20par%20d%C3%A9faut%20combin%C3%A9%20%C3%A0%20la%20localisation%20du%20fichier%20DEF%20semble%20fonctionner%2C%20mais%20semble%20%C3%AAtre%20un%20hack%20inconfortable.Le%20retour%20sur%20investissement%20en%20vaut%20probablement%20la%20peine%20-%20j'ai%20un%20fichier%20d'inclusion%20standard%20pour%20toutes%20mes%20d%C3%A9finitions%20de%20chemin%20de%20fichier%20mais%20avec%20des%20r%C3%A9visions%20distinctes%20pour%20chaque%20compl%C3%A9ment%20(c'est-%C3%A0-dire%20le%20m%C3%AAme%20probl%C3%A8me%20que%20vous%20d%C3%A9crivez)%2C%20donc%20%C3%AAtre%20capable%20de%20d%C3%A9couvrir%20dynamiquement%20l'ID%20du%20compl%C3%A9ment%20parent%20serait%20extr%C3%AAmement%20utile%20fonctionnalit%C3%A9.Tant%20et%20si%20bien%2C%20le%20hack%20commence%20%C3%A0%20sembler%20attrayant%20-%20je%20n'avais%20pas%20pens%C3%A9%20%C3%A0%20lire%20le%20fichier%20DEF%20...%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-49549%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20JSL%20identifie%20le%20chemin%20du%20script%20en%20cours%20d'ex%C3%A9cution%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-49549%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EJ'utilise%20g%C3%A9n%C3%A9ralement%20la%20fonction%20Get%20Default%20Directory%20ou%20la%20fonction%20Convert%20File%20Path%20avec%20une%20cha%C3%AEne%20vide%20pour%20obtenir%20le%20chemin%20du%20script%20actuel.%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Epath1%20%3D%20Get%20Default%20Directory()%3B%0Apath2%20%3D%20Convert%20File%20Path(%20%22%22%20)%3B%0A%0AShow(%20path1%2C%20path2%20)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EVoici%20le%20journal%20lorsque%20j'ex%C3%A9cute%20ce%20script%20%C3%A0%20partir%20d'un%20fichier%20situ%C3%A9%20dans%20mon%20dossier%20%22C%3A%5CPublic%22%3A%3C%2FP%3E%0A%3CPRE%3Epath1%20%3D%20%22%2FC%3A%2FPublic%2F%22%3B%0Apath2%20%3D%20%22%2FC%3A%2FPublic%2F%22%3B%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-49545%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20JSL%20identifie%20le%20chemin%20du%20script%20en%20cours%20d'ex%C3%A9cution%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-49545%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3ESi%20je%20ne%20peux%20pas%20obtenir%20que%20com.cmpny.dept.addin1%20l'appelle%2C%20et%20que%20je%20n'utilise%20PAS%20l'approche%20de%20compl%C3%A9ment%20commune%20sugg%C3%A9r%C3%A9e%20par%20pmroz%2C%20alors%20savoir%20dans%20quel%20dossier%20se%20trouvait%20ce%20script%20est%20suffisant%20car%20je%20peux%20ouvrir%20le%20compl%C3%A9ment%20.def%20du%20m%C3%AAme%20dossier%20et%20extrayez%20l'identifiant%20%C3%A0%20partir%20de%20l%C3%A0.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECela%20me%20donne%20en%20fait%20une%20deuxi%C3%A8me%20application%20potentielle.%20Si%20je%20peux%20entrer%20dans%20le%20addin.def%20d'un%20compl%C3%A9ment%20en%20cours%20d'ex%C3%A9cution%20(mais%20pour%20le%20moment%2C%20je%20n'arrive%20pas%20%C3%A0%20le%20faire)%2C%20je%20pourrais%20faire%20une%20v%C3%A9rification%20de%20version%20en%20obtenant%20l'id%20et%20addinVersion%20de%20addin.def%20puis%20comparer%20cela%20%C3%A0%20une%20liste%20des%20derni%C3%A8res%20versions%20de%20compl%C3%A9ments%20que%20je%20pourrais%20obtenir%20en%20utilisant%20Internet%20Open.%20Je%20pourrais%20alors%20savoir%20si%20l'addinVersion%20locale%20de%20l'utilisateur%20est%20la%20plus%20r%C3%A9cente%20et%20la%20plus%20performante.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-49543%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20JSL%20identifie%20le%20chemin%20du%20script%20en%20cours%20d'ex%C3%A9cution%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-49543%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EOui%2C%20mais%20je%20souhaite%20inclure%20une%20ligne%20dans%20General%20Functions.jsl%20qui%20identifie%20quel%20autre%20compl%C3%A9ment%20appelle%20une%20fonction%20dans%20General%20Functions.jsl.%3C%2FP%3E%3CP%3EEn%20d'autres%20termes%2C%20dans%20com.cmpny.dept.addin1%2C%20un%20script%20peut%20appeler%20une%20fonction%20dans%20General%20Functions.jsl.%20Je%20veux%20faire%20r%C3%A9f%C3%A9rence%20%C3%A0%20une%20variable%20dans%20General%20Functions.jsl%20qui%20r%C3%A9v%C3%A9lera%20que%20com.cmpny.dept.addin1%20l'a%20appel%C3%A9e.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-49541%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20JSL%20identifie%20le%20chemin%20du%20script%20en%20cours%20d'ex%C3%A9cution%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-49541%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EPourquoi%20ne%20pas%20faire%20du%20fichier%20d'inclusion%20commun%20son%20propre%20compl%C3%A9ment.De%20cette%20fa%C3%A7on%2C%20vous%20pouvez%20l'inclure%20via%20quelque%20chose%20comme%3A%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%2F%2F%20Load%20functions%20common%20to%20various%20apps%0Ainclude(%22%24ADDIN_HOME(com.cmpny.dept.common)%5CGeneral%20Functions.jsl%22)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
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.

Recommended Articles