cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
thomasz
Level IV

Storing preferences in a variable

In a script, I would like to:

 

1. Store current preferences in a variable to be able to later restore them

2. Modify some preferences

... do some stuff in the script, like importing an Excel file that requires specific preferences set to work ...

3. Restore the original preferences

 

Is there any way to do the above in JMP? I know how to modify preferences, but I cannot find a way to store current preferences to be able to restore them.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Storing preferences in a variable

If you add an assignment to the Get Prferences() function, it will assign the preference expression to the variable

Names Default To Here( 1 );
x=Get Preferences( );

Examples of retrieving and saving preferences are found in the Scripting Index.

You can either manipulate the expression or convert it to a character string and manipulate it using the string functions.  Then as you apply it, you just convert it back to an expression and then apply it.

Jim

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: Storing preferences in a variable

If you add an assignment to the Get Prferences() function, it will assign the preference expression to the variable

Names Default To Here( 1 );
x=Get Preferences( );

Examples of retrieving and saving preferences are found in the Scripting Index.

You can either manipulate the expression or convert it to a character string and manipulate it using the string functions.  Then as you apply it, you just convert it back to an expression and then apply it.

Jim
thomasz
Level IV

Re: Storing preferences in a variable

Thanks for your swift reply. Had actually just realized it myself and rushed to delete the post, but too late What confused me was that the variable returned an empty value, but using show(x), I could see that the variable contained a script that returns the empty value I was viewing. Maybe it will help somebody else getting confused about this in the future!

jthi
Super User

Re: Storing preferences in a variable

If this is in a script/tool that someone else besides you might be using, I would strongly suggest saving them into a file which won't be accidentally overwritten.

I have seen quite a few scripts/tools which modify users preferences with the idea of returning them. But if there is an error and there is no proper error handling... if you re-run the script, your preferences are basically gone as the variable will be overwritten with the modified preferences.

-Jarmo
stan_koprowski
Community Manager Community Manager

Re: Storing preferences in a variable

Hi @thomasz,

There is a Preferences Manager (with import/export)  add-in that performs these tasks already.

Have a look and try it out to see if it will meet your needs.

 

cheers,

Stan