Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

Help with a Script to delete extra paths and spare some

$
0
0

Here are a couple scripts that I have so far, but neither work. With the first script I get an error with the "indexOf", and with the second script, it only keeps the second name that is listed in the string. How can I get either of these to work where I can delete all paths except for the multiple ones I want to keep?

 

function deletepaths()
{  if (!documents.length) return false;  var doc = activeDocument;  var save = ["Ex1", "Ex2", "Ex3"];  for (var x = 0; x < doc.pathItems.length; x++)  {    if (save.indexOf(doc.pathItems[x].name) == -1))    {      doc.pathItems[x].remove();    }  }
}
deletepaths();

 

 

deletepaths();
function deletepaths(){
if(!documents.length) return;
var doc = activeDocument;
for(var a = doc.pathItems.length-1;a>-1;a--){
if(doc.pathItems[a].name != ("ex1", "Ex2"))     doc.pathItems[a].remove();  }
}

Viewing all articles
Browse latest Browse all 12244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>