2 Replies Latest reply on Aug 2, 2010 1:51 PM by Seth McGraw

    Changing prefs with javascript (CS1-CS5)

    Seth McGraw Level 1

      Items created on one side of the spread need to be duplicated and moved to the other side (template information, etc.). We need the preferences in InDesign CS1-CS5 to remember layers when pasting during the running of the script, but we don't want to permanently hijack the customers preferences.


      Is there a way to 1) check a preference setting, 2) apply a change if needed, and then 3) return the setting to its previous state only if changed?


      Thanks in advance,



        • 1. Re: Changing prefs with javascript (CS1-CS5)
          [Jongware] Most Valuable Participant

          I'm not sure if this was even a preference pre-CS3, and, if so, if it always has been exposed to the scripting engine. In CS4, it is scriptable as a boolean value:




          .. and the usual way of working around nasty user preferences is this:


          1. Start of script:


          originalValue = app.clipboardPreferences.pasteRemembersLayers;

          app.clipboardPreferences.pasteRemembersLayers = true;


          2. Do Your Stuff.


          3. End of script:


          app.clipboardPreferences.pasteRemembersLayers = orginalValue;

          • 2. Re: Changing prefs with javascript (CS1-CS5)
            Seth McGraw Level 1



            One of the guys tried it with a similar boolean if/then statement and it worked. We will try the slimmed down code you've shown. I'm sure it will work. Thanks again.