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-364125%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20Obtenir%20l'int%C3%A9gralit%C3%A9%20du%20contenu%20du%20script%20de%20table%20(y%20compris%20les%20commentaires)%26nbsp%3B%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-364125%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EMerci.C'est%20ce%20dont%20j'avais%20peur%20-%20il%20n'y%20a%20aucun%20moyen%20d'acc%C3%A9der%20par%20programme%20aux%20commentaires%2C%20sauf%20en%20utilisant%20une%20sorte%20de%20vilaine%20bricole%20du%20c%C3%B4t%C3%A9%20des%20commentaires.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJ'ai%20trouv%C3%A9%20une%20fa%C3%A7on%20plus%20agr%C3%A9able%20d'accomplir%20cela.Je%20joins%20le%20bloc%20de%20commentaire%20d'en-t%C3%AAte%20%C3%A0%20l'int%C3%A9rieur%20de%20JSL%20Quote()%20qui%20incite%20l'interpr%C3%A9teur%20JSL%20%C3%A0%20conserver%20mon%20bloc%20de%20commentaire%20au%20lieu%20de%20le%20supprimer.Alors%20maintenant%2C%20je%20peux%20lire%20le%20champ%20de%20cat%C3%A9gorie%20et%20l'utiliser%20en%20cons%C3%A9quence.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EVoici%20mon%20exemple%20de%20script%26nbsp%3B%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EJSL%20Quote(%0A%2F*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20%0A%20*%20Script%20Name%3A%20%20%20my%20script%20name%0A%20*%20Script%20Category%3A%20%20%26lt%3B%3CMY%20category%3D%22%22%3E%26gt%3B%0A%20*%20Author%3A%20%20%20%20author%20name%0A%20*%20Rev%20Date%3A%20%20%20date%0A%20*%20Purpose%3A%20%20%20%20purpose%0A%20*%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20*%2F%0A)%3B%0A%0A%2F%2Fthis%20comment%20will%20be%20deleted%0A%0Adt%20%3D%20Current%20Data%20Table()%3B%0AscriptText%20%3D%20Char(dt%20%26lt%3B%26lt%3B%20Get%20Table%20Property(%22my%20script%20name%22))%3B%0AscriptCategory%20%3D%20Char(Regex(scriptText%2C%22%5C%26lt%3B%5C%26lt%3B(%5BA-Za-z0-9%20%5C%2F%5D*)%5C%26gt%3B%5C%26gt%3B%22%2C%20%22%5C1%22))%3B%0AWrite(%22%5C!n%22%20%7C%7C%20scriptText%20%7C%7C%20%22%5C!n%22)%3B%0AWrite(%22%5C!n%22%20%7C%7C%20scriptCategory%20%7C%7C%20%22%5C!n%22)%3B%3C%2FMY%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EEt%20la%20sortie%20dans%20le%20journal%26nbsp%3B%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EJSL%20Quote(%0A%2F*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20%0A%20*%20Script%20Name%3A%20%20%20my%20script%20name%0A%20*%20Script%20Category%3A%20%20%26lt%3B%3CMY%20category%3D%22%22%3E%26gt%3B%0A%20*%20Author%3A%20%20%20%20author%20name%0A%20*%20Rev%20Date%3A%20%20%20date%0A%20*%20Purpose%3A%20%20%20%20purpose%0A%20*%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20*%2F%0A)%3B%20dt%20%3D%20Current%20Data%20Table()%3B%20scriptText%20%3D%20Char(dt%20%26lt%3B%26lt%3B%20Get%20Table%20Property(%22my%20script%20name%22))%3B%20scriptCategory%20%3D%20Char(Regex(scriptText%2C%20%22%5C%26lt%3B%5C%26lt%3B(%5BA-Za-z0-9%20%5C%2F%5D*)%5C%26gt%3B%5C%26gt%3B%22%2C%20%22%5C1%22))%3B%20Write(%22%0A%22%20%7C%7C%20scriptText%20%7C%7C%20%22%0A%22)%3B%20Write(%22%0A%22%20%7C%7C%20scriptCategory%20%7C%7C%20%22%0A%22)%0A%0Amy%20category%3C%2FMY%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-364048%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20Obtenir%20l'int%C3%A9gralit%C3%A9%20du%20contenu%20du%20script%20de%20table%20(y%20compris%20les%20commentaires)%26nbsp%3B%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-364048%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3ELa%20seule%20fa%C3%A7on%20que%20je%20connaisse%20pour%20contourner%20ce%20probl%C3%A8me%20est%20de%20placer%20chaque%20commentaire%20dans%20une%20cha%C3%AEne%20litt%C3%A9rale%20factice%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Edt%3Dcurrent%20data%20table()%3B%0Aeval(parse(%22%5C%5Bdt%20%26lt%3B%26lt%3B%20new%20script(%22mysct%22%2C%20%0Acomment%3D%22%2F**************************************%2F%22%3B%0Anames%20default%20to%20here(1)%3B%0Adt%3Dcurrent%20data%20table()%3B%0Acomment%3D%22%2F%2F%20Here%20come%20more%20comments%22%3B%0A%3B%5D%5C%22))%3B%20%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-364005%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EObtenir%20l'int%C3%A9gralit%C3%A9%20du%20contenu%20du%20script%20de%20table%20(y%20compris%20les%20commentaires)%26nbsp%3B%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-364005%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EJ'essaie%20de%20proposer%20un%20syst%C3%A8me%20pour%20organiser%20tous%20les%20scripts%20JSL%20attach%C3%A9s%20%C3%A0%20ma%20table%20de%20donn%C3%A9es.Je%20souhaite%20ins%C3%A9rer%20un%20en-t%C3%AAte%20dans%20les%20commentaires%20en%20haut%20de%20chacun%20de%20mes%20scripts.Il%20ressemblera%20%C3%A0%20ceci%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%2F*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20%0A%20*%20Script%20Name%3A%20%20my%20script%20name%0A%20*%20Script%20Category%3A%20%20%26lt%3B%3CCATEGORY%3E%26gt%3B%0A%20*%20Author%3A%20%20%20%20author%20name%0A%20*%20Rev%20Date%3A%20%20%20date%0A%20*%20Purpose%3A%20%20%20purpose%0A%20*%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20**%20*%20*%2F%3C%2FCATEGORY%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EDans%20cet%20en-t%C3%AAte%2C%20je%20conserverai%20quelques%20m%C3%A9tadonn%C3%A9es%20sur%20chacun%20des%20scripts.Par%20exemple%2C%20le%20champ%20%C2%AB%26nbsp%3Bcat%C3%A9gorie%20de%20script%26nbsp%3B%C2%BB%20qui%20est%20plac%C3%A9%20entre%20crochets.Je%20veux%20pouvoir%20parcourir%20les%20scripts%20et%20les%20manipuler%20en%20fonction%20de%20ces%20m%C3%A9tadonn%C3%A9es.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJe%20sais%20que%20je%20peux%20obtenir%20une%20liste%20de%20tous%20les%20scripts%20attach%C3%A9s%20%C3%A0%20ma%20table%20de%20donn%C3%A9es%20comme%20ceci%26nbsp%3B%3A%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Edt%20%3D%20Current%20Data%20Table()%3B%0AscriptList%20%3D%20dt%20%26lt%3B%26lt%3B%20Get%20Table%20Script%20Names%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEt%20puis%20je%20peux%20obtenir%20le%20contenu%20d'un%20script%20comme%20celui-ci%26nbsp%3B%3A%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EscriptText%20%3D%20Char(dt%20%26lt%3B%26lt%3B%20Get%20Table%20Property(scriptList%5B1%5D))%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3ECependant%2C%20le%20scriptText%20ne%20contient%20aucun%20commentaire.La%20section%20d'en-t%C3%AAte%20est%20manquante%2C%20je%20ne%20peux%20donc%20pas%20acc%C3%A9der%20aux%20m%C3%A9tadonn%C3%A9es%20contenues%20dans%20ces%20commentaires.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EExiste-t-il%20un%20moyen%20d'obtenir%20le%3CU%3E%20complet%3C%2FU%3E%20texte%20d'un%20script%20de%20table%2C%20y%20compris%20les%20commentaires%26nbsp%3B%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-364005%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3EAutomatisation%20et%20scripts%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Choose Language Hide Translation Bar
Chris_Rodrigues
Level III

Get entire contents of table script (including comments)?

I am trying to come up with a system to organize all the JSL scripts attached to my data table.  I want to insert a header in the comments at the top of each of my scripts.  It will look like this:

 

/* ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** 
 * Script Name:		my script name
 * Script Category:		<<category>>
 * Author:				author name
 * Rev Date:			date
 * Purpose:			purpose
 * * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * */

Inside of this header I will keep some metadata about each of the scripts.  For example, the "script category" field which is enclosed in angle brackets.  I want to be able to iterate over the scripts and manipulate them based on this metadata.

 

I know that I can obtain a list of all the scripts attached to my data table  like this:

dt = Current Data Table();
scriptList = dt << Get Table Script Names;

 

And then I can get the contents of a script like this:

scriptText = Char(dt << Get Table Property(scriptList[1]));

However, the scriptText does not contain any of the comments.  The header section is missing, so I can't access the metadata contained within those comments.

 

Is there a way to get the full text of a table script, including comments?

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Chris_Rodrigues
Level III

Re: Get entire contents of table script (including comments)?

Thanks.  That's what I was afraid of - there's no way to programmatically access the comments except using some kind of ugly kludge on the comments side of things.

 

I did figure out a nicer-looking way to accomplish this.  I enclose the header comment block inside of JSL Quote() which tricks the JSL interpreter into keeping my comment block instead of deleting it.  So now I can read the category field and use it accordingly.

 

Here's my example script:

 

JSL Quote(
/* ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** 
 * Script Name:			my script name
 * Script Category:		<<my category>>
 * Author:				author name
 * Rev Date:			date
 * Purpose:				purpose
 * * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * */
);

//this comment will be deleted

dt = Current Data Table();
scriptText = Char(dt << Get Table Property("my script name"));
scriptCategory = Char(Regex(scriptText,"\<\<([A-Za-z0-9 \/]*)\>\>", "\1"));
Write("\!n" || scriptText || "\!n");
Write("\!n" || scriptCategory || "\!n");

And the output to the log:

 

JSL Quote(
/* ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** 
 * Script Name:			my script name
 * Script Category:		<<my category>>
 * Author:				author name
 * Rev Date:			date
 * Purpose:				purpose
 * * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * */
); dt = Current Data Table(); scriptText = Char(dt << Get Table Property("my script name")); scriptCategory = Char(Regex(scriptText, "\<\<([A-Za-z0-9 \/]*)\>\>", "\1")); Write("
" || scriptText || "
"); Write("
" || scriptCategory || "
")

my category

 

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Get entire contents of table script (including comments)?

The only way that I know of to kluge my way around this is to place each comment into a dummy literal string

dt=current data table();
eval(parse("\[dt << new script("mysct", 
comment="/**************************************/";
names default to here(1);
dt=current data table();
comment="// Here come more comments";
;]\")); 
Jim
Chris_Rodrigues
Level III

Re: Get entire contents of table script (including comments)?

Thanks.  That's what I was afraid of - there's no way to programmatically access the comments except using some kind of ugly kludge on the comments side of things.

 

I did figure out a nicer-looking way to accomplish this.  I enclose the header comment block inside of JSL Quote() which tricks the JSL interpreter into keeping my comment block instead of deleting it.  So now I can read the category field and use it accordingly.

 

Here's my example script:

 

JSL Quote(
/* ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** 
 * Script Name:			my script name
 * Script Category:		<<my category>>
 * Author:				author name
 * Rev Date:			date
 * Purpose:				purpose
 * * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * */
);

//this comment will be deleted

dt = Current Data Table();
scriptText = Char(dt << Get Table Property("my script name"));
scriptCategory = Char(Regex(scriptText,"\<\<([A-Za-z0-9 \/]*)\>\>", "\1"));
Write("\!n" || scriptText || "\!n");
Write("\!n" || scriptCategory || "\!n");

And the output to the log:

 

JSL Quote(
/* ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** 
 * Script Name:			my script name
 * Script Category:		<<my category>>
 * Author:				author name
 * Rev Date:			date
 * Purpose:				purpose
 * * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * */
); dt = Current Data Table(); scriptText = Char(dt << Get Table Property("my script name")); scriptCategory = Char(Regex(scriptText, "\<\<([A-Za-z0-9 \/]*)\>\>", "\1")); Write("
" || scriptText || "
"); Write("
" || scriptCategory || "
")

my category

 

Recommended Articles