cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
pauldeen
Level VI

Lock journal through scripting

In recent versions of JMP we now have the option to lock journals. How can I incorpoerate that into my scripts? I expect it to be something like:

current journal() << lock;

 

1 ACCEPTED SOLUTION

Accepted Solutions
mmarchandFSLR
Level III

Re: Lock journal through scripting

The journal window has to be the active window.  This works for me.

 

Window( "Journal: Untitled" ) << Bring Window to Front;
Wait( 0 );
Main Menu( "Lock Journal" );

 

Edit:

 

There's a better way.  You can specify the window within the Main Menu() function.

 

 

Main Menu( "Lock Journal", "Journal: Untitled" );

View solution in original post

3 REPLIES 3
R2OKeefe
Level II

Re: Lock journal through scripting

Did anyone ever find a way to do this? I had the same assumption, that the syntax would be similar to what you put, but it doesn't work. I also tried the following and none of them worked either, all of them result in an error. 

current journal() << Lock(1);
current journal() << LockJournal;
current journal() << LockJournal(1);
current journal() << SetLock(1);

Error Message:Object 'HeadBox' does not recognize the message '<command>';

 

 

I did notice if you look at the "Customize" -> "Menus and Toolbars" window, that the "Edit" -> "Lock Journal" menu command has a Built-in Command of "EDIT:LOCK JOURNAL", but I cannot figure out a way to get the script to run the built in command. I tried these but none worked. 

 

Current Journal() << Main Menu("EDIT:LOCKJOURNAL");
Current Journal() << Run Script( Main Menu("EDIT:LOCKJOURNAL"); );

Error Message: Object 'HeadBox' does not recognize the message 'Main Menu';

 

I also tried to run this with Journal as active window. Command executes, but doesn't lock the Journal

 

Main Menu("EDIT:LOCKJOURNAL");

 

 

mmarchandFSLR
Level III

Re: Lock journal through scripting

The journal window has to be the active window.  This works for me.

 

Window( "Journal: Untitled" ) << Bring Window to Front;
Wait( 0 );
Main Menu( "Lock Journal" );

 

Edit:

 

There's a better way.  You can specify the window within the Main Menu() function.

 

 

Main Menu( "Lock Journal", "Journal: Untitled" );
pauldeen
Level VI

Re: Lock journal through scripting

Great, and a little more generic with code references that might be used in other parts of the script:

text box("abc") << journal;
jrn = Current Journal();
Main Menu( "Lock Journal", jrn << get window title);