7 Replies Latest reply on Jul 4, 2016 3:01 AM by tpk1982

    Overprint Issue

    tpk1982 Level 4

      Hi,

       

      I am using the below script for applying overprint ON/OFF in particular layer. It is working fine till now. But recently i noticed this is not applying correctly in the expanded stroke lines.

       

      My script:

       

      var w = new Window ("dialog");
      var radio_group = w.add ("panel");
      radio_group.alignChildren = "left";
      radio_group.onover = w.add ("radiobutton", undefined, "Overprint ON");  
      radio_group.offover = w.add ("radiobutton", undefined, "Overprint OFF");  
      radio_group.onover.value=true;
      w.add ("button", undefined, "OK");
      w.add ("button", undefined, "Cancel");
      
      
      var myResult = w.show(); 
      if(myResult == true){
          if (radio_group.onover.value ==  true){
              myON(true);
          }
          else{myON(false);}
      }
      //w.show ();
      
      
      function myON(Otrue){
      var doc = app.activeDocument;  
      var items = doc.activeLayer.pageItems;  
         for (var i = 0; i < items.length; i++) {  
              doc.activeLayer.locked = false;
            app.executeMenuCommand ('selectall');  
           app.executeMenuCommand ('ungroup');  
                if(items[i].filled == true){
                    items[i].fillOverprint=Otrue;
                       }
              if(items[i].stroked == true){
                    items[i].strokeOverprint=Otrue;
                      }
              
          }  
      }
      

       

       

      The below item is not applied:

       

      Screen Shot 2016-07-01 at 6.01.22 PM.png

       

      Screen Shot 2016-07-01 at 6.04.30 PM.png

       

       

      Please help to sort this problem.

       

      Thanks,

      Karthi

        • 1. Re: Overprint Issue
          Silly-V Adobe Community Professional

          Hey Karthi, what's up my homie! Okay, so when you ungroup the items, may your item count be changing and screwing it all up?

           

          Try moving things that do not belong in your loop such as ungrouping and unlocking layer, outside of the loop. Good luck!

          1 person found this helpful
          • 2. Re: Overprint Issue
            tpk1982 Level 4

            Hi Silly-V,

             

            Tried and failed. I removed the lock and ungroup coding. But again it is not applied.

             

            If a stroked line expanding it turned as fill. Maybe this cause problem?

             

            Am not sure the terms about compound path.

             

            Scripting in Illustrator is tedious for me every time

             

            Thanks,

            Karthi

            • 3. Re: Overprint Issue
              tpk1982 Level 4

              The script working if i use Release  Compound Path option

              Screen Shot 2016-07-04 at 10.45.56 AM.png

               

              Thanks,

              Karthi

              • 4. Re: Overprint Issue
                tpk1982 Level 4

                var items = doc.activeLayer.compoundPathItems;   

                 

                even this also not taken as account.. my head is rounding now

                 

                Please help

                • 5. Re: Overprint Issue
                  Ten A Adobe Community Professional

                  Try below:

                  app.activeDocument.compoundPathItems[0].pathItems[0].strokeOverprint = true;
                  
                  1 person found this helpful
                  • 6. Re: Overprint Issue
                    Alexander Ladygin Level 2

                    As an option:

                    var w = new Window ("dialog"),
                        radio_group = w.add ("panel");
                    radio_group.alignChildren = "left";
                    radio_group.onover = w.add ("radiobutton", undefined, "Overprint ON");
                    radio_group.offover = w.add ("radiobutton", undefined, "Overprint OFF");
                    radio_group.onover.value=true;
                    w.add ("button", undefined, "OK");
                    w.add ("button", undefined, "Cancel");
                    
                    
                    var myResult = w.show();
                    if (myResult == true) {
                        if (radio_group.onover.value == true) myON(true);
                        else myON(false);
                    }
                    function myON (Otrue) {
                        var doc = app.activeDocument,
                            items = doc.activeLayer.pageItems;
                        for (var i = 0; i < items.length; i++) {
                            var item = items[i];
                            doc.activeLayer.locked = false;
                            app.executeMenuCommand ('selectall');
                            app.executeMenuCommand ('ungroup');
                            if ( items[i].typename === 'CompoundPathItem' ) {
                                item = items[i].pathItems[0];
                            }
                            if (item.filled) {
                                item.fillOverprint = Otrue;
                            }
                            if (item.stroked) {
                                item.strokeOverprint = Otrue;
                            }
                        }
                    }
                    
                    • 7. Re: Overprint Issue
                      tpk1982 Level 4

                      Hi alexanderl15015835,

                       

                      Awesome, it is working like a charm.. so happy...thanks you so much

                       

                      @Ten A: Thanks for your answer

                       

                      Regards,

                      Karthi