• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Save settings for panels

Explorer ,
Sep 06, 2016 Sep 06, 2016

Copy link to clipboard

Copied

I got a question - is there a good workaround how to save settings of a panel? I intend to offer different options of a panel, which the user shall be able to turn off and on. I thought of saving the settings as Json-file. I just don't know how to do this best, or does anyone have a better idea or another way to get the result?

TOPICS
Actions and scripting

Views

709

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Sep 06, 2016 Sep 06, 2016

You can set Persistence on (so that when the user re-opens the panel **in the same PS session** it will keep the same status), or alternatively use LocalStorage, for sessions independent persistence.

Davide Barranca

http://htmlpanelsbook.com

Votes

Translate

Translate
Adobe
Advocate ,
Sep 06, 2016 Sep 06, 2016

Copy link to clipboard

Copied

You can set Persistence on (so that when the user re-opens the panel **in the same PS session** it will keep the same status), or alternatively use LocalStorage, for sessions independent persistence.

Davide Barranca

http://htmlpanelsbook.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 06, 2016 Sep 06, 2016

Copy link to clipboard

Copied

Thanks for the quick answer. Does this mean that the LocalStorage stays saved permanently? I have the LocalStorage of the browser in mind. is that right? isn't that deleted at some point?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Sep 07, 2016 Sep 07, 2016

Copy link to clipboard

Copied

I assume that you are referring to (HTML) Panels – am I right?

If this is the case, yes, Local Storage is the same that's featured in browser. It's there (I mean, the stuff you save there) until you yourself delete it – otherwise it's permanent.

If you rely on scripted dialogs instead (ScriptUI and not HTML Panels) customOptions are a similar feature that you can use.

Davide

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 07, 2016 Sep 07, 2016

Copy link to clipboard

Copied

Thanks for the answers, which helps me a lot.

yes it is an HTML Panel.

Joe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 07, 2016 Sep 07, 2016

Copy link to clipboard

Copied

you can use

"app.putCustomOptions('yourID',decriptor,true);" //true = persistent

I am using it for JSX Dialog not html panel. But it could be similar with html panel too. But I can't guarantee it now.

My code looks like this:

var settingsToRemember = {};

      settingsToRemember.splitBy=win.sliderPanel.te.text;

      settingsToRemember.chRemoveOriginal=win.bottomGroup.chRemoveOriginal.value;

      settingsToRemember.dropdownSplitingCharactersOptions=dropdownSplitingCharactersOptions.selection.index;

      settingsToRemember.chLineBreak=win.specialPanel.chLineBreak.value;

      settingsToRemember.chLineEnd=win.specialPanel.chLineEnd.value;

      settingsToRemember.chTab=win.specialPanel.chTab.value;

      settingsToRemember.chLetter=win.specialPanel.chLetter.value;

      settingsToRemember.chParagraphStyles=paragraphSplit;

      settingsToRemember.chCharacterStyles=characterSplit;

     

      var desc = new ActionDescriptor();// create a descriptor to hold value 

      desc.putString(0, jamJSON.stringify(settingsToRemember));   // f*ck Action descriptor system... use serialized JSON instead

      app.putCustomOptions('Split', desc, true );// store the descriptor by unique name 

jamJSON is not native function

And this is for reading settings:

var desc = app.getCustomOptions("Split");

        var formSettings = jamJSON.parse(desc.getString(0));

        win.sliderPanel.te.text=formSettings.splitBy;

        dropdownSplitingCharactersOptions.selection=formSettings.dropdownSplitingCharactersOptions;

        win.specialPanel.chLetter.value = formSettings.chLetter;

        win.specialPanel.chParagraphStyles.value = formSettings.chParagraphStyles;

        win.specialPanel.chCharacterStyles.value = formSettings.chCharacterStyles;

        win.specialPanel.chTab.value = formSettings.chTab;

        win.specialPanel.chLineEnd.value = formSettings.chLineEnd;

        win.specialPanel.chLineBreak.value = formSettings.chLineBreak;

        win.bottomGroup.chRemoveOriginal.value = formSettings.chRemoveOriginal; 

jamJSON

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 08, 2016 Sep 08, 2016

Copy link to clipboard

Copied

LATEST

many thanks for the answer,

but in this case I create an HTML Panel
Joe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines