The script editor provides a friendly environment for writing and reading JSL scripts. The Script Editor shows basic features such as syntax coloring, inline commenting, and automatic formatting. Other common programming options are described later in this section.
To run an entire script, select Edit > Run Script.
To run specific lines in a script, select those lines and then select Edit > Run Script.
To run specific lines that are not adjacent, hold down the Control key, select the lines, and then select Edit > Run Script.
•
|
Type //! on the first line.
|
•
|
To stop the script, press ESC on Windows (or COMMAND-PERIOD on Macintosh). You can also select Edit > Stop Script. On Macintosh, Edit > Stop Script is available only when the script is running.
Suppose that you want to clear your JSL variables, but do not remember the command. You can type clear and then press CTRL-SPACE, to see a list of possible clear commands. Select the command that you want to insert.
The tooltip shows the syntax, arguments, and a brief explanation of the function (Tooltip for a JSL Function). The tip also appears in the script editor window status bar.
After running a script, you can also place the cursor over variable names to see their current value. To turn off variable tooltips, deselect Preferences > Script Editor > Show Variable Value Tips.
To turn off function tooltips, deselect Preferences > Script Editor > Show Operator Tips.
•
|
To split an open Script Editor window, right-click in the window and select Split > Horizontal or Vertical.
|
•
|
The script editor helps you match fences (or parentheses, square brackets, and curly braces) in the following ways:
•
|
You can turn on and off the auto completion of braces in the JMP preferences. See Set Preferences for the Script Editor for details.
Select a rectangular portion beginning with Y. When you paste, you get the following code:
The rectangular selection inserts returns where needed to maintain the structure of the text. Select Get Menu Item State on both lines in the following example.
Basic regular expressions such as ^ and $ (which match the start of line and end of line) and \n (which matches a carriage return) are also supported.
See the Using JMP book for details about the Search options.
You can also reformat individual scripts that are difficult to read (for example, scripts in which all commands are strung together with no whitespace characters). From the Edit menu, select Reformat Script.
To turn on this feature, select JSL code folding in the Script Editor preferences. Then you can expand and collapse blocks of code by right-clicking on a script and selecting Advanced > Expand All or Collapse All.
Tip: To fold or expand all code in the entire script, press SHIFT and CTRL then click on a code marker.
After you select this preference, Function and Expr expressions are foldable. See Add More Folding Keywords for details about adding folding markers to other expressions.
By default, code does not remain collapsed after you save the script and restart JMP. To save the state of the folded code, select Save and restore document state information in the Script Editor preferences.
JMP supports multiple keyword lists. A system administrator can define a set of keywords in jmpKeywords.jsl and save the script in C:\ProgramData\SAS\JMP\ or designated directory listed below. You save your version of jmpKeywords.jsl in your C:\Users\<user>\Documents\ folder. JMP merges all keyword lists from the designated directories.
•
|
The list in jmpKeywords.jsl is case insensitive.
|
•
|
After you edit and save the list in jmpKeywords.jsl, turn the Allow additional code folding keywords preference off and then back on for the changes to take effect. Messages in the log indicate that the keywords were loaded.
|
1.
|
Select File > Preferences.
|
2.
|
Select the Fonts group.
|
3.
|
Click Mono to set the font for the script editor.
|
For more details about font preferences, see the Using JMP book.
Select File > Preferences > Script Editor to further customize the editor.
Select this option to cause the script editor to add spaces between words within operator names. For example, turning on this option results in New Window instead of NewWindow. This option is selected by default.
|
|
Select this option to use code folding markers in the script editor, which mark the opening and closing of Function() and Expr() expressions. You can expand and collapse these marked blocks of code. This option is off by default.
Tip: To fold or expand all code in the entire script, press SHIFT and CTRL then click on a code marker.
You can also choose the appearance of the marker using the JSL code folding marker menu.
Select Allow additional code folding keywords to enable using additional keywords for folding markers in the script editor. See Add More Folding Keywords for details.
|
|
To set your own color for any of the listed types, click the color box and select your color. See Color Coding for details on default settings.
|
For more details about script editor preferences, see the Using JMP book.