发布日期: 08/07/2020

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 Missing( 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(...);
需要更多信息?有问题?从 JMP 用户社区得到解答 (community.jmp.com).