You can use the Create Folder message to create new folders on JMP Live. The Create Folder message exists on both the JMP Live Connection and JMP Live Folder scriptable objects. The syntax is similar.
When you create a folder, you specify where to create it (the folder it resides in), the folder title, and an optional description. You can also specify what JMP should do if the folder that you are trying to create already exists.
Here is the syntax of the Create Folder message on a JMP Live Connection object:
liveresult = liveconnection << Create Folder( Title( "title" ),
Parent Folder( "id" | "path" | JMP Live Folder ), < Description( "description" ),
If Exists( "use" | "fail" | "default" ) > );
The If Exists option tells JMP what to do if the folder that you are trying to create already exists:
• Specify use if you want JMP to just return the folder that already exists.
• Specify fail if JMP should fail the operation if the folder already exists.
• Specify default (or omit the If Exists option) if you want JMP to create a new folder anyway. If necessary, JMP appends (2) to the name of the folder to make it unique.
This example uses a JMP Live Folder object instead of a JMP Live Connection object to create a new folder. It also assumes that a space named Fab exists on JMP Live.
Names Default To Here( 1 );
// Create a connection to the JMP Live server.
liveconnection = New JMP Live();
/* Create a folder in the Fab space with a title and a description using the connection that you just created. */
jmpliveresult = liveconnection << Create Folder( Parent Folder( "/Fab" ), Title( "Create Folder Example" ), Description( "My new folder"), If Exists( "use" ) );
// Obtain the JMP Live Folder object from the JMP Live Result.
folder = jmpliveresult << As Scriptable;
// Get the path of the new folder.
path = folder << Get Path();
// Output the folder path to the JMP log.
Write( "Path: ", path );
// JMP Log output: "Path: /Fab/Create Folder Example"