7 Replies Latest reply on Dec 19, 2013 12:55 PM by Laubender

    Send response to dialog

    pkrk Level 1

      I typically have


      app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT


      at the begining of my scripts. But when duplicating a swatch, InDesign only seems to duplciat the swatch if I allow the script/Indesign to interact.

      Can I respond to the duplciate swatch dialog via the script so I can get my swatch copied without it "asking" the user? (Jaavascript)

        • 1. Re: Send response to dialog
          Laubender Adobe Community Professional & MVP

          @pkrk – can you give us a more precise description? And some code?


          Who or what wants to duplicate a swatch?

          The user in the UI? Your script?


          If the user in the UI, do you have created a ScriptUI Panel with some functionality that is visible in the UI while the user is doing "normal" layout work in InDesign? And if yes, why do you prevent the user from seeing alert messages setting the userInteractionLevel to NEVER_INTERACT?


          What exact version of InDesign on what exact version of OS is this script running?



          • 2. Re: Send response to dialog
            pkrk Level 1

            Screen Shot 2013-12-18 at 3.50.00 PM.png

            This is the message that I want the script to say yes to or else it doesn't duplicate when I do

            app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;




            //Creative Cloud - OS X.8.5


            myDocument = app.activeDocument;


            mySwatches = new Array();



            for(nextSwatch=0; nextSwatch<myDocument.swatches.length;nextSwatch++)






                        mySwatches[swatchCounter]= myDocument.swatches[nextSwatch];








            for(nextSwatch=0; nextSwatch<mySwatches.length;nextSwatch++)








            //There are more steps after the fact that rename the swatches and do some other steps which is why I don't want the user being asked. I just want the "PANTONE" swatches duplicated.

            • 3. Re: Send response to dialog
              Laubender Adobe Community Professional & MVP

              Ah. Now I begin to understand…


              You want to suppress the message when duplicating the swatch.
              And you tried with userInteractionLevel set to NEVER_INTERACT.


              What obviously does not work.
              So you want the script  answer the alert dialog  with "Yes".


              Hm; not my realm, but maybe this would be possible with an AppleScript.


              On the other hand, why duplicating an existing swatch?


              What is the benefit?

              To change some properties after duplicating? Like name, color values etc.?
              You could do that with adding a swatch to the document with the add() method.



              • 4. Re: Send response to dialog
                pkrk Level 1

                hmmm... "add" may be the ticket. I can add the new color and copy the properties of the pantone(hopefully).


                The names of the pantones have to change for a workflow. Color might change sometimes.



                I'll try it out and post back. If someone has a way to say yes to the dialog I would still like to try that.

                • 5. Re: Send response to dialog
                  pkrk Level 1

                  At the moment, adding a color doesn't seem like it will work for this scenaraio since I will want to get color of the pantone and name it something else.


                  I'll need to find how to say yes to the dialog.

                  • 6. Re: Send response to dialog
                    pkrk Level 1

                    Add a swatch and copying the properties worked for me.



                    • 7. Re: Send response to dialog
                      Laubender Adobe Community Professional & MVP

                      Can you share a code snippet?