Highlighted

action delete path with any name

Community Beginner ,
Jun 16, 2019

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?

Topics

Actions and scripting

Views

250

Likes

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

action delete path with any name

Community Beginner ,
Jun 16, 2019

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?

Topics

Actions and scripting

Views

251

Likes

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
Adobe Community Professional ,
Jun 16, 2019

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).

Likes

2 Likes

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
Reply
Loading...
Explorer ,
Jun 29, 2020

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? 

Likes

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
Reply
Loading...
Adobe Community Professional ,
Jun 29, 2020

Copy link to clipboard

Copied

Likes

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
Reply
Loading...
Adobe Community Professional ,
Jun 29, 2020

Copy link to clipboard

Copied

Likes

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
Reply
Loading...