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

Accessing the elements of a page item

Community Beginner ,
Jan 06, 2014 Jan 06, 2014

Good people of the Adobe forums,

I am working on a script that performs a series of things on all of the artwork in a document.  At one point, it needs to compare the fill color of every item to a sample color.  The problem is, the artwork is a collection of compound path items and path items.  When I look for pathItems.fillColor, it works fine.  When I look for compoundPathItem.fillColor, it comes back undefined.  So, I've moved to looking at page items, but I seem to be unable to get to the internals on the page items.  If I have a compound path item, how would I address its properties from its parent page item?  I tried:

pageItem.compoundPathItem.pathItems[0].fillColor,

pageItems.fillColor,   & 

pageItems.compoundPathItem.fillColor. 

They all seem to break.

TOPICS
Scripting
4.4K
Translate
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
Adobe
Advocate ,
Jul 27, 2018 Jul 27, 2018

Salut !

// JavaScript Document

function test() {
  var docRef = activeDocument;
    var obj, type, liste, tabs, ch;
        liste = "";
        tabs = docRef.pathItems;
        alert("tabs.length = "+tabs.length)
      if (tabs.length) {
        for(var i = 0, o = 0; i < tabs.length; i++) {
          obj = tabs;
          type = obj.parent.typename;
            if(type == "CompoundPathItem") {
              ch = obj.parent.pathItems[0].fillColor.typename;
              i += obj.parent.pathItems.length-1;
              o++;
              liste += "Objet "+o+" "+type+"\r"+ch+"\r";
            }
            else {
              ch = obj.fillColor.typename;
              o++;
              liste += "Objet "+o+" "+obj.typename+"\r"+ch+"\r";
            }

        }
        alert(liste);
      }
      else alert("Aucun tracé trouvé ?","De Elleere");
}

test();

de elleere

Translate
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