Copy link to clipboard
Copied
I have to do a simple action to delete the clipping paths in many photos, the problem is that the tracks have different names in the various photos and the action then always crashes. How can I do?
Copy link to clipboard
Copied
This script will remove all path types (unsaved work paths, saved paths, clipping paths and vector shape paths):
// remove ALL path types
if (documents.length > 0) {
docRef = activeDocument;
for (var i = docRef.pathItems.length-1 ; i >=0 ; i--) {
$.writeln(docRef.pathItems.kind);
docRef.pathItems.remove();
}
} else {
alert("There must be at least one open document to run this script!");
}
This script removes all paths except clipping paths:
//https://www.hilfdirselbst.ch/foren/Script_um_Pfade_zu_l%F6schen_P372902.html
var myPath = activeDocument.pathItems;
for (n = myPath.length-1; n>-1; n--)
{ aP = myPath;
if(aP.kind != "PathKind.CLIPPINGPATH" ) { aP.remove() }
}
This script also removes all paths except clipping paths:
//https://feedback.photoshop.com/photoshop_family/topics/multiple_path_deletion_please
#target Photoshop
main();
function main(){
if(!documents.length) return;
var doc = activeDocument;
for(var a = doc.pathItems.length-1;a>-1;a--){
if(doc.pathItems.kind != PathKind.CLIPPINGPATH) doc.pathItems.remove();
}
}
NOTE: You should be able to swap out the "if" line code that read as " != " with " === " to only delete clipping paths, such as:
//https://feedback.photoshop.com/photoshop_family/topics/multiple_path_deletion_please
#target Photoshop
main();
function main(){
if(!documents.length) return;
var doc = activeDocument;
for(var a = doc.pathItems.length-1;a>-1;a--){
if(doc.pathItems.kind === PathKind.CLIPPINGPATH) doc.pathItems.remove(); // != changed to ===
}
}
One could then record the execution of this script into an action, then apply the action via Batch Action/Image Processor/Image Processor Pro/Picture Processor scripts to multiple files (take care, perhaps backup first).
Copy link to clipboard
Copied
How do you make a .jsx file with these scripts? Is there a program or notepad that I need to be using in order to save these scripts out properly so Photoshop can use them?
Copy link to clipboard
Copied
All should be answered here:
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html?m=1
Copy link to clipboard
Copied