BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
Highlighted
Tzu-Chun

Community Trekker

Joined:

Oct 25, 2017

How can I run a script when exits JMP?

Hi,

 

There is a way to run a script at start up. However, what should I do if I would like to run a script when exits JMP?

The following code is an idea for doing that, but it didn't work in JMP.

win=window("Home Window");
win<<on close(
	new window("Goodbye :)",
		<<modal,
		text box("Thanks for using JMP")
	)
);

Any thoughts are appreciated.

 

Best.

1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales

Staff

Joined:

Mar 21, 2013

Solution

Re: How can I run a script when exits JMP?

addin supports:

 

Click the Exit Script tab to add a script that runs when JMP exits or when you disable the add-in. You can select an existing script (Run JSL in this file) or copy and paste in a script (Run this JSL). For example, you could provide a prompt for the user to export a JMP data table upon exiting or disabling the add-in.

Craige
4 REPLIES 4
txnelson

Super User

Joined:

Jun 22, 2012

Re: How can I run a script when exits JMP?

Here is a little script that works......the key is that one does not have access to the Home Window, but you can get the pointer to the overall JMP environment through << Top Parent.  And it will remain viable as long as the window you go through stays available.  So below is my solution to that.

x = New Window( " ");
win = Window( 1 ) << top parent;
x << show window(0);
win << on close(
	New Window( "Goodbye :)", <<modal, Text Box( "Thanks for using JMP" ) );
	quit("no save");
	RunProgram( executable( "C:\Program Files\Windows Media Player\wmplayer.exe" ) );
	
);

Maybe someone else can come up with a better reference point to the top parent.

Jim
Tzu-Chun

Community Trekker

Joined:

Oct 25, 2017

Re: How can I run a script when exits JMP?

Hi Jim,

I love the idea you gave, and it works in my computer. However, as you mentioned, if someone would like to clean all windows from window list, JMP will be closed even users does not intend to. I really appreciate your prompt reply and help.
Craige_Hales

Staff

Joined:

Mar 21, 2013

Solution

Re: How can I run a script when exits JMP?

addin supports:

 

Click the Exit Script tab to add a script that runs when JMP exits or when you disable the add-in. You can select an existing script (Run JSL in this file) or copy and paste in a script (Run this JSL). For example, you could provide a prompt for the user to export a JMP data table upon exiting or disabling the add-in.

Craige
Tzu-Chun

Community Trekker

Joined:

Oct 25, 2017

Re: How can I run a script when exits JMP?

Hi Craige,

This is what I am looking for. Thanks a lot for your prompt help : )