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(); }
... View more