BookmarkSubscribe
Choose Language Hide Translation Bar
Community Trekker

## How to determine if a JMP journal is already opened?

Hi,

I have a script in which the user will have the option of running an analysis multiple times.  The script will create a journal of the results.  However, I would like the script to create a new journal the first time it is run, but add results to the existing journal when the script is run subsequently.  Is there a way to determine if a specific (or any) journal is already open in JMP?

I found a way to determine if a data table is already opened (), but I have not gotten it to work for a journal.  Any advice?

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: How to determine if a JMP journal is already opened?

There are probably several ways to do this. Here is one idea that seems to work (tested in JMP 10).

//Function to test if a specific journal exists

Already_there = Function( {jname},

n = N Items( Window() );

If( jname == Current Journal() << get window title, // If no journal is open Current Journal() will open one

Print( "Journal exists" )

,

If( N Items( Window() ) - n == 1,

Current Journal() << close window); // Close the redundant journal if created

Print( "There is no such journal" );

);

);

//Test of function

j_title = "Test";

my_journal = Current Journal(); // Example journal

my_journal << set window title( j_title );

my_journal << close window; // Close example journal

2 REPLIES 2
Super User

## Re: How to determine if a JMP journal is already opened?

There are probably several ways to do this. Here is one idea that seems to work (tested in JMP 10).

//Function to test if a specific journal exists

Already_there = Function( {jname},

n = N Items( Window() );

If( jname == Current Journal() << get window title, // If no journal is open Current Journal() will open one

Print( "Journal exists" )

,

If( N Items( Window() ) - n == 1,

Current Journal() << close window); // Close the redundant journal if created

Print( "There is no such journal" );

);

);

//Test of function

j_title = "Test";

my_journal = Current Journal(); // Example journal

my_journal << set window title( j_title );