cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
martin_snogdahl
Level III

Can I close the jmp program from a script?

Hi

I have created an application in jmp. When the application is run, a series of hidden data tables is created, depending on the user input. When the user decides to close the application window, I would like to run a script to close these open tables before the application is closed. One way to achieve this is to disable the 'red cross' to close the window and define my own button to close the application. Now, how do I disable the ‘red cross’? I’m guessing I have to pass some kind of WinAPI command…

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
pmroz
Super User

Re: Can I close the jmp program from a script?

Thanks to Dan Schikore for helping me with this same issue.  In the script portion of Application Builder put the following code:

 

(thisModuleInstance<<GetBox) << On Close(
	close(soc_dataset, nosave);
	close(hlgt_dataset, nosave);
	close(hlt_dataset, nosave);
	close(pt_dataset, nosave);
	close(smq_dataset, nosave);
);

Obviously your statements will be different.

View solution in original post

5 REPLIES 5
txnelson
Super User

Re: Can I close the jmp program from a script?

w = New Window(.................................);
w << On Close(
     loop through the data tables and close them
);

You can always use an On Close, to take action on an application window, that will save those tables. 

 

Help==>Scripting Index==>On Close

Jim
martin_snogdahl
Level III

Re: Can I close the jmp program from a script?

I guess I was over complicating things a bit. My next question: using the application builder, how do I create a reference to the application window? When I use the Current Window() command I get a reference to the Application Builder window, not to the application window it self.  

txnelson
Super User

Re: Can I close the jmp program from a script?

In the application builder each object, report, etc. is given a name, you should be able to attach the On Close to the appropriate object, including the overall application
Jim
pmroz
Super User

Re: Can I close the jmp program from a script?

Thanks to Dan Schikore for helping me with this same issue.  In the script portion of Application Builder put the following code:

 

(thisModuleInstance<<GetBox) << On Close(
	close(soc_dataset, nosave);
	close(hlgt_dataset, nosave);
	close(hlt_dataset, nosave);
	close(pt_dataset, nosave);
	close(smq_dataset, nosave);
);

Obviously your statements will be different.

martin_snogdahl
Level III

Re: Can I close the jmp program from a script?

That did the trick. Thank you!