2 Replies Latest reply on Feb 2, 2010 1:51 AM by ramkumar.vp

    Find Object Gap Color

    Shonkyin Level 3

      Hi All,

       

      Please suggest me why below code not working.

       

      var myDoc = app.activeDocument;

      app.findObjectPreferences=app.changeObjectPreferences=null;

      app.findObjectPreferences.gapColor = myDoc.swatches[1] //paper

      app.changeObjectPreferences.gapColor = myDoc.swatches[0] //None

      myDoc.changeObject()

      app.findObjectPreferences=app.changeObjectPreferences=null;

       

       

      Thanks in advance,

      Shonky

        • 1. Re: Find Object Gap Color
          ramkumar.vp Level 3

          Hi Shonky,


          I think Find & Changing the objects by using colors will not work in InDesign CS3 JS.


          Try to do the process in some other way.


          Regards,

          Ramkumar .P

          • 2. Re: Find Object Gap Color
            Shonkyin Level 3

            Thanks Ramkumar,

             

            I am using Indesign CS4 and code not working in CS4 too.

             

            I got the solution with below code:

             

            var myDoc = app.activeDocument;

            var mypageItems = myDoc.allPageItems

            for (a=0; a<mypageItems.length; a++)

            {

            if (mypageItems[a].constructor.name == "Group")

            {

            continue;

            }

            mypageItems[a].gapColor = "None"

            }

            var mygroupItems = myDoc.groups

            for (a=0; a<mygroupItems.length; a++)

            {

            for (b=0; b<mygroupItems[a].allPageItems.length; b++)

            {

            if (mygroupItems[a].allPageItems[b].constructor.name != "Group")

            {

            mygroupItems[a].allPageItems[b].gapColor = "None"

            }

            }

            }

             

            Its strange that find object not working. My previous code was correct i think.

             

            Shonky