To automatically complete various analyses and tasks, you can create a JSL script and save it to the data table (Figure 4.62). For more information about writing data table scripts, see Table Scripts in the Scripting Guide.
Figure 4.62 Scripts Saved With the Data Table
Once you have run an analysis and you are in the report window, you can add a script to the data table. This script generates the JSL that reproduces your analysis.
To save a script to the data table
From the report window, click the red triangle for the platform and select Save Script > To Data Table.
First, you create your analysis, then you save the script.
1. Select Help > Sample Data Library and open Big Class.jmp.
2. Select Analyze > Fit Y by X.
3. Select weight and click Y, Response.
4. Select height and click X, Factor.
5. Click OK.
6. Click the red triangle next to Bivariate Fit of weight By height and select Fit Line.
7. Click the red triangle next to Bivariate Fit of weight By height and select Save Script > To Data Table.
8. In the Save Script As window, enter the name of the script.
9. To replace an existing script with the same name, select it from the Name list and select Replace existing script.
10. To save a script that has the same name as an existing script and use the same name, select Append unique suffix.
A number is added to the end of the script name.
11. Click OK.
The script is added to the bottom of the Table panel.
Tip: If you want a particular script to run automatically every time the data table is opened, name the script OnOpen. Only one script saved in the data table can be set to run automatically. If you name the script Model (or model) in a Fit Model script, the launch window is automatically filled in based on the script when you select Analyze > Fit Model.
To add a script to a data table using JSL
1. Click the red triangle to the left of the data table name in the Table panel.
Figure 4.63 Creating a Script
2. Select New Script.
3. Give the script a name by typing it into the box beside Name.
4. Add the script by entering JSL code into the box beside Script.
5. Perform one of the following actions:
– If you want to run the JSL Debugger on the script to check it for errors, click Debug Script.
– If you are finished editing the script, click OK. The script appears in the Table panel and the window closes.
– If you are not finished editing the script and want to save it, click Save. The script appears in the Table panel and the window remains open for further editing.
– If you want to run the script, click Run.
To run, edit, delete, or copy a script that is saved to the data table
1. In the Table panel, right-click the green triangle beside the script’s name or right-click the script name.
2. Select one of the following commands:
– Run Script
– Edit
– Delete
– Copy
Once you copy a script, you can then paste it into a script window or into the Table panel of another data table.