cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
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!