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 );
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 );
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 file
How are you making it so the block string isn't all one color? Mine just looks like this:
Or is that just an artifact of the forum?
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.
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
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.