When you call a JMP Live JSL function or message, most return a JMP Live Result object. This object returns detailed information about the success or failure of an operation. For successful operations, you can retrieve relevant, scriptable objects from the JMP Live Result object by sending it the As Scriptable message.
Here is an example showing how JMP Live Result objects are used in a case that succeeds and a case that fails.
// Create a connection to the JMP Live server.
liveconnection = New JMP Live();
/* Create a new folder in the Fab space. This operation should return a JMP Live Result object showing that the operation succeeded. */
jmpliveresult = liveconnection << Create Folder( Parent Folder( "/Fab" ), Title( "Result Objects" ));
/* Check whether the operation was successful. If so, obtain the resulting JMP Live Folder object. */
If( jmpliveresult << Succeeded,
folder = jmpliveresult << As Scriptable;
,
errorMsg = jmpliveresult << Get Error Message;
Write( "\!nCreate Folder failed: ", errorMsg);
);
/* Try to get a folder that does not exist. This operation returns a JMP Live Result object showing that the operation failed. */
jmpliveresult = liveconnection << Get Folder( "/Fab/Not a real folder" );
/* Check whether the operation was successful. If not, print the error message that was returned. */
If( jmpliveresult << Succeeded,
folder = jmpliveresult << As Scriptable;
,
errorMsg = jmpliveresult << Get Error Message;
Write( "\!nGet Folder failed: ", errorMsg);
);