Subscribe Bookmark RSS Feed

Can I close the jmp program from a script?

martin_snogdahl

Community Trekker

Joined:

Aug 17, 2016

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

Joined:

Jun 23, 2011

Solution

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.

5 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

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

Community Trekker

Joined:

Aug 17, 2016

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

Joined:

Jun 22, 2012

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

Joined:

Jun 23, 2011

Solution

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

Community Trekker

Joined:

Aug 17, 2016

That did the trick. Thank you!