For the latest version of JMP Help, visit JMP.com/help.


Publication date: 11/29/2021

Get a Project

When running a JSL script from within a project, you can use the This Project() function to obtain that project. The following example displays the name of the current project in a new window.

project = This Project();
If( Is Empty( project ),
 

/* if the script is not run from a project, display this

sentence in the new window */

	New Window( "My Project", Text Box( "Script isn’t running in a project." ) ),
 

/* if the script is run from a project, display the window title

in the new window */

	New Window( "My Project", Text Box( project << Get Window Title() ) )
);

Get Project() takes the same arguments as the Window() function. Omit the arguments to get a list of the currently open projects, include a string to find a specific project by title, or include a number to get the ith open project.

Open( "$SAMPLE_PROJECTS/Big Class.jmpprj" );
Open( "$SAMPLE_PROJECTS/Sports.jmpprj" );
 

// print the title of Sports.jmpprj

Print( Get Project( 2 ) << Get Window Title() );

Get Project() is also helpful when you want to save a project or set the layout from within the project.

Get Project() << Save(...);
Get Project() << Set Layout(...);
Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).