该帮助的版本不再更新,请参见https://www.jmp.com/support/help/zh-cn/15.2 获取最新的版本.


dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << New Script( "Bivariate Example", Bivariate( Y( :weight), X( :height ) ) );
dt << Get Table Variable( "Bivariate Example" );
dt << Run Script( "Bivariate Example" )
dt << Set Property( "Bivariate Example", Bivariate( Y( :weight ), X( :height ), Fit Line ) ); // includes Fit Line in the Bivariate Example script
Suppose you want a text representation of a data table, perhaps to e-mail to a colleague or to use as part of a script. You can obtain a script that reconstructs the information in a data table with Get Script. The following example opens Big Class.jmp and prints the data, table variables, and column properties to the log. A portion of the output is shown here:
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Get Script;
Delete Script deletes one or more scripts.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Delete Script( "Distribution" );
注意:In JMP versions prior to 14, use Delete Property to delete a script.
To enable a Try() expression to capture the error:
注意: 
You can prompt to open a table script named On Open or OnOpen when the data table opens. The choice is remembered each time you open the data table in the current JMP session.
To create an On Open script, perform one of the following actions:
Create the script using the Save Script > To Data Table option, and then double-click the property name and change the name to On Open.
Store the script using a New Script message.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << New Script(
"OnOpen", // create the script
sortedDt = Data Table( "Big Class" ) << Sort( By( :name ), Output Table Name( "Sorted Big Class" ) ) // sort the data and put it in a new data table
On Open scripts that execute other programs are never run. As a safety precaution, you might consider suppressing automatic execution when opening data tables that you receive from others.
注意: 
If the OnOpen script is in a downloaded data table, you must specify Quarantine Action( "Allow Scripts" ) in the Open() expression to run the OnOpen script automatically. See Options for Downloaded Data Tables that Contain Scripts.
When you create a new data table in a script and include the On Open() function, On Open() is called after the data table is created.
Suppose that you want to put related table scripts in a group to save room in the list of data table scripts. Use Group Scripts, specify the group name, and then specify the script names to put in the group.
dt = Open( "$SAMPLE_DATA/San Francisco Crime.jmp" );
dt << Group Scripts(
"Maps",
{"Bubble Plot Street Map", "Graph Builder Street Map: Traffic Incidents",
"Graph Builder Street Map Zoomed"}
dt << Group Scripts(
"Tabulate",
{"Tabulate: Category and Description", "Tabulate: Category, Summary, Percentage",
"Tabulate: Category and Resolution", "Tabulate: Resolution and Description"}
Move Script Group rearranges the table script groups using the to first, to last, after(script), and after(group) arguments:
To get the list of table scripts in the group, use Get Script Group. Then you can perform an operation such as running a script in the group.
Get Script Groups Names returns the group names in a list:
Select Script Group selects the named table script group, a list of scripts in a group, or all scripts.
Ungroup Scripts removes specified table scripts or group from the group. You can send the message to the name of the script group or a list of scripts.
You can rename a table script group using Rename Script Group, specifying the existing group name, and specifying the new group name.