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

action delete path with any name

Participant ,
Jun 16, 2019 Jun 16, 2019

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
1.8K
Translate
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
Adobe
Community Expert ,
Jun 16, 2019 Jun 16, 2019

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

Translate
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
Explorer ,
Jun 29, 2020 Jun 29, 2020

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? 

Translate
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
Community Expert ,
Jun 29, 2020 Jun 29, 2020
Translate
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
Community Expert ,
Jun 29, 2020 Jun 29, 2020
LATEST
Translate
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