Subscribe Bookmark RSS Feed

How to determine if a JMP journal is already opened?

robot

Community Trekker

Joined:

Feb 27, 2012

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
Solution

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 );

Already_there( j_title );

my_journal << close window; // Close example journal

Already_there( j_title );

2 REPLIES
Solution

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 );

Already_there( j_title );

my_journal << close window; // Close example journal

Already_there( j_title );

robot

Community Trekker

Joined:

Feb 27, 2012

Works great!  Thanks!