How I can define a variable that is recorded in JMP, so next time I open it I still have access to it?
For example, global variables are defined as:
::my_global_variable = 42;
Try this code:
Names Default to Here( 1 ); save assignment = Char( ::my_global_variable = 42; ); Save Text File( "Saved Assignment.jsl", save assignment ); // either immediately execute Include( "Saved Assignment.jsl" ); // or save character string before executing or furthe processing save assignment = Load Text File( "Saved Assignment.jsl" ); Parse( save assignment );
(I did not test it.)
I will add to @Mark_Bailey response.
JMP allows for a script to be run at startup. Check in the Scripting Guide for the version of JMP you are using for the name and location where you need to place the file.
Here is the documentation for JMP 15
Run a Script at Start UpYou can run the same script every time you start JMP. For example, you might include thedefinitions of some utility functions or a namespace that you want available throughout yourJMP session. You might also set some preferences in a startup script to keep preferencesconsistent. Preferences persist across JMP sessions, but you could explicitly reset somepreferences in case they were changed at some point in the previous session.Name the script jmpStart.jsl and place it in one of the following folders, as appropriate foryour operating system. When JMP starts, JMP looks for the jmpStart.jsl script in these foldersin the order in which they are listed here. The first one that is found is run, and the searchimmediately stops.Note: Some path names in this section refer to the “JMP” folder. On Windows, in JMP Pro, the“JMP” folder is named “JMPPro”.On Windows:1. C:/Users/<username>/AppData/Roaming/SAS/JMP/152. C:/Users/<username>/AppData/Roaming/SAS/JMPOn macOS:1. /Users/<username>/Library/Application Support/JMP/152. /Users/<username>/Library/Application Support/JMPThe jmpStart.jsl script runs only for a particular user on a computer. You can add a scriptnamed jmpStartAdmin.jsl in one of the following places, as appropriate for your operatingsystem. This script is run for every user on a computer. JMP runs jmpStartAdmin.jsl first iffound. Then JMP runs jmpStart.jsl if found.On Windows:1. C:/ProgramData/SAS/JMP/152. C:/ProgramData/SAS/JMPOn macOS:1. /Library/Application Support/JMP/152. /Library/Application Support/JMP
Note: For JMPPro the directory path references to JMP change to JMPPro,
In that file you could place a simple line:
Try( Include( "Saved Assignment.jsl" ) );
Everytime JMP would startup, it would look for the file, and run it if the file existed.
If the values are changed and need to be re-saved, consider using an add-in. Add-ins can have a script that runs when JMP starts and a script that runs when JMP stops. The add-in does not need to have an item in the menu to do this.
Also consider keeping the values in a data table with a column for each value. You probably only need a single row, but a 2nd row could be an alternate set of values. The data table will also provide a save prompt, so the add-in might not be needed.