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

How do I loop through plugin items and expand legacy compound paths?

Enthusiast ,
Jan 03, 2019 Jan 03, 2019

Copy link to clipboard

Copied

I'm trying to use the below script to combat legacy compound paths that result from Photoshop. I tried placing a try catch around the expandStyle menu command, to combat errors, but in testing with and without it, it appears that I'm unable to use expand style, unless I select the plugin items myself. I tried adding $.sleep to see if it just needed time to catch up, but to no avail. The multiple redraws helped in other situations that scripts ran too fast but don't seem to be doing much in this case. Is there a different way I should be selecting these items via scripting to ensure I can expand them?


Below is what the group looks like when I select via script:

Below is what it looks like when I select it manually, note the target is highlighted:

//Expand Legacy Compound Shapes

var pI = app.activeDocument.pluginItems;

for(i=pI.length-1;i>=0;i--){

if(pI.tracing == "[TracingObject]") {

    var curPI = pI; //Set object to variable so deselection also function

    curPI.selected = true;

    redraw();// redraw before for possible errors

    app.executeMenuCommand("expandStyle");

    redraw();// redraw before for possible errors

    curPI.selected = false;

    redraw();// redraw after for possible errors

    }

}

TOPICS
Scripting

Views

728

Translate

Translate

Report

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
no replies

Have something to add?

Join the conversation
Adobe