cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
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

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

4 REPLIES 4
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");

 

 

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);
David_Burnham
Super User (Alumni)

Re: Lock journal through scripting

On my computer atleast, this works on JMP 17 but for JMP 18 it failed. Fortunately it looked like a timing problem. This worked:

 

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

Recommended Articles