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

how do you create a new script file from jsl

3 ACCEPTED SOLUTIONS

Accepted Solutions

Re: how do you create a new script file from jsl

You can use Save Text File and use a .jsl extension.

Example:

script = "// here's some JSL\!rShow(\!"Hello, World!\!");";
Save Text File( "$desktop\MyScript.jsl", script );

 

View solution in original post

Re: how do you create a new script file from jsl

You can also use the JSL Quote function to make creating a string of JSL code a little easier.

 

script = JSL Quote( // here's some JSL
Show("Hello, World!"); );
Save Text File( "$desktop\MyScript.jsl", script );
Justin

View solution in original post

Craige_Hales
Super User

Re: how do you create a new script file from jsl

You could also use the square-bracket quote mechanism, and then open the result in a script editor window. Note the backslash and the open or close square bracket are not part of the saved text, and the embedded quotes need no escaping.

filename = Save Text File(
	"$temp/DeleteMe.JSL", 
// this is the opening square-bracket quote
"\[ 
// comment 1
write("these quotes need no special treatment
and the newline works too
"); // comment 2
//comment 3
]\" // this is the closing square-bracket quote
);

editor = Open( filename, "script" ); // "script" might be needed if the extension is missing

Script Editor Window with contents of fileScript Editor Window with contents of file

Craige

View solution in original post

7 REPLIES 7

Re: how do you create a new script file from jsl

You can use Save Text File and use a .jsl extension.

Example:

script = "// here's some JSL\!rShow(\!"Hello, World!\!");";
Save Text File( "$desktop\MyScript.jsl", script );

 

Re: how do you create a new script file from jsl

You can also use the JSL Quote function to make creating a string of JSL code a little easier.

 

script = JSL Quote( // here's some JSL
Show("Hello, World!"); );
Save Text File( "$desktop\MyScript.jsl", script );
Justin
Craige_Hales
Super User

Re: how do you create a new script file from jsl

You could also use the square-bracket quote mechanism, and then open the result in a script editor window. Note the backslash and the open or close square bracket are not part of the saved text, and the embedded quotes need no escaping.

filename = Save Text File(
	"$temp/DeleteMe.JSL", 
// this is the opening square-bracket quote
"\[ 
// comment 1
write("these quotes need no special treatment
and the newline works too
"); // comment 2
//comment 3
]\" // this is the closing square-bracket quote
);

editor = Open( filename, "script" ); // "script" might be needed if the extension is missing

Script Editor Window with contents of fileScript Editor Window with contents of file

Craige
vince_faller
Super User (Alumni)

Re: how do you create a new script file from jsl

How are you making it so the block string isn't all one color? Mine just looks like this:

 

Capture.PNG

 

Or is that just an artifact of the forum?

 

 

Vince Faller - Predictum

Re: how do you create a new script file from jsl

That's an artifact of the forum. It tries to use syntax coloring, but it doesn't parse JSL perfectly. So what is one string, and hence one color, in JMP confuses the parser here.

Niros
Level II

Re: how do you create a new script file from jsl

Hello,

Following this discussion, when saving JSL files the result scripts contains the variables names and not their content which changes in a for loop.

Any advise on how to fix this?

Thank You,

Nir

ms
Super User (Alumni) ms
Super User (Alumni)

Re: how do you create a new script file from jsl

There are several ways, and the best probably depends on which of the above methods use. If you need to evaluate variables in a jsl-string I suggest checking out the function Eval Insert(). For jsl code Eval Expr() is very useful.