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

Remove All PathItems is Buggy

Enthusiast ,
Feb 24, 2015 Feb 24, 2015

Copy link to clipboard

Copied

Just wanted to post this up in case others are experiencing the same thing. If you have vector layers in Photoshop and simply "app.activeDocument.pathItems.removeAll();" there are several results you may experience, based on what is selected. I have documented that below in my function.

The simplest workaround to avoid these errors is to deselect layers, made easy by this script. Javascript - deselect all layers

Begin Script:

function deselectLayers() {  

    var desc01 = new ActionDescriptor();  

        var ref01 = new ActionReference();  

        ref01.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );  

    desc01.putReference( charIDToTypeID('null'), ref01 );  

    executeAction( stringIDToTypeID('selectNoLayers'), desc01, DialogModes.NO );  

};

function psRemovePaths() {

/*

BY DEFAULT REMOVEALL PATHITEMS WILL

- With a single vector shape selected, it will delete itself with inconsistent results, sometimes deleting others.

- With all layers selected, it will delete just the vector masks

- With Multiple layers selected, it will delete all vector,

- With a raster layer selected, it will not delete anything

- With no layesr selected it will not delete anything.

WE MUST DESELECT LAYERS FIRST

*/

    deselectLayers();

    app.activeDocument.pathItems.removeAll();

}

TOPICS
Actions and scripting

Views

272

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