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

P: Ability to delete multiple paths

Participant ,
Apr 08, 2011 Apr 08, 2011

Copy link to clipboard

Copied

Why can't you delete more than one path at a time? You can do this with Channels and layers... the path palette hasn't changed in ages.

Idea Released
TOPICS
macOS , Windows

Views

830

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
community guidelines

correct answers 1 Correct answer

Adobe Employee , Jun 20, 2013 Jun 20, 2013
This should now be possible in Photoshop CC with the new multi-path selection capabilities.

Votes

Translate

Translate
66 Comments
Valorous Hero ,
Sep 05, 2012 Sep 05, 2012

Copy link to clipboard

Copied

No problem Jeff, here you are...



#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[a].name != "Outlined") doc.pathItems[a].remove();
}
RemoveAlphaChannels();
}
function RemoveAlphaChannels() {
var channels = app.activeDocument.channels;
var channelCount = channels.length - 1;
while ( channels[channelCount].kind != ChannelType.COMPONENT ) {
channels[channelCount].remove();
channelCount--;
}
}

Votes

Translate

Translate

Report

Report
Guest
Sep 05, 2012 Sep 05, 2012

Copy link to clipboard

Copied

THANK YOU Paul... it works beautifully! Feels like Christmas this morning! Putting the script into a sweet little action makes my path-heavy photoshop work feel like it's in the 21st century. The one for channels will be quite useful too.

Votes

Translate

Translate

Report

Report
Explorer ,
Sep 05, 2012 Sep 05, 2012

Copy link to clipboard

Copied

Paul,
WOW!! what a sweet deal.
You made my week!
These work great.
Hmmmm...... now what other photoshop problems can I have you fix?? ;-)

thx
JeffN

Votes

Translate

Translate

Report

Report
Explorer ,
Sep 05, 2012 Sep 05, 2012

Copy link to clipboard

Copied

Maybe this is not the place to post this, (start a new post?), but while I know that expert Paul Riggot is following this thread I have another question about scripts.

Is it possible to make a square / rectangular selection and have a script add guides to the four sides of the selection?

On most all photographs I shoot I put cropping guides for the client to see what I / we were visioning at the time of the shoot for cropping. I make a marque selection or use the crop tool to crop the image. Then I drag out 4 guides to place around the selection / crop. I deselect or cancel the crop which leaves me with the 4 cropping guides.
This is an often repeated process. I wish I could have a script or something that would put the 4 guides around the selection.

thx
JeffN

Votes

Translate

Translate

Report

Report
Valorous Hero ,
Sep 05, 2012 Sep 05, 2012

Copy link to clipboard

Copied

Nice easy one Jeff....

 

#target Photoshop
main();
function main(){
if(!documents.length) return;
var startRulerUnits = preferences.rulerUnits;
try{
preferences.rulerUnits = Units.PIXELS
var SB = activeDocument.selection.bounds;
}catch(e){return;}
guideLine(SB[1].value,"Hrzn");
guideLine(SB[3].value,"Hrzn");
guideLine(SB[0].value,"Vrtc");
guideLine(SB[2].value,"Vrtc");
preferences.rulerUnits = startRulerUnits;
}
function guideLine(position, type){
var desc = new ActionDescriptor();
var desc2 = new ActionDescriptor();
desc2.putUnitDouble( app.charIDToTypeID('Pstn'), app.charIDToTypeID('#Pxl'), position );
desc2.putEnumerated( app.charIDToTypeID('Ornt'), app.charIDToTypeID('Ornt'), app.charIDToTypeID(type) );
desc.putObject( app.charIDToTypeID('Nw '), app.charIDToTypeID('Gd '), desc2 );
executeAction( app.charIDToTypeID('Mk '), desc, DialogModes.NO );
};

Votes

Translate

Translate

Report

Report
Explorer ,
Sep 05, 2012 Sep 05, 2012

Copy link to clipboard

Copied

Paul....
"Nice easy One"????
you make me laugh (lol)
I heard Einstein said the same thing when he was asked about he came up with the concept of the "Theory of Relativity".

I'm blown away. I may as well be trying to read Chinese.

The script works perfectly. I can't help but just shake my head....
I've been wishing I had this for years. I thought it was a crazy thing to even ask Adobe about. And here by chance I come across this posting and find that you have solved three issues I've been struggling with.

Thank you hardly seems adequate.

I had no idea that being able to write scripts was so powerful and useful.
If I had it in me to learn how to do this (not sure I do), where would you suggest I go to for clear "how to" instructions.

Thanks for everything. How do I add points to your profile?
You deserve something!!

JeffN

Votes

Translate

Translate

Report

Report
Valorous Hero ,
Sep 05, 2012 Sep 05, 2012

Copy link to clipboard

Copied

There are a few great scripting forums:-

http://forums.adobe.com/community/pho...
http://forums.adobe.com/community/bri...

http://www.ps-scripts.com/bb/

Also there is documentation at:
http://www.adobe.com/devnet/photoshop...

Hope these help and have fun learning 🙂

Votes

Translate

Translate

Report

Report
New Here ,
Sep 20, 2012 Sep 20, 2012

Copy link to clipboard

Copied

Paul, thank you for taking the time and sharing this!

Votes

Translate

Translate

Report

Report
LEGEND ,
Feb 12, 2013 Feb 12, 2013

Copy link to clipboard

Copied

Guys look What I found... you know.. if you make a lot of path you can group it example :(grouping path 2 & 3 into path 1) by first select path 2 > Ctrl+C then select path 1 then Ctrl+V ...then select path 3 Ctrl+C then select path 1 Ctrl+V. simple as that.. well at least if you have 3 path 😛 owh yeah with Mac ofcourse you would use Cmd+C and Cmd+V that's a shortcut for copy & paste. happy pathing~ :)

Btw I'm using Cs6

Votes

Translate

Translate

Report

Report
Engaged ,
Feb 14, 2013 Feb 14, 2013

Copy link to clipboard

Copied

If I'd have that many paths to delete, I'd write a script for it.
Something like this:

//remove all paths except clipping path

for (var p = 0; thecopy.pathItems.length > p ; ) {
if (thecopy.pathItems[p].kind == PathKind.CLIPPINGPATH) {
p++
}
else {
thecopy.pathItems[p].remove()
}

Votes

Translate

Translate

Report

Report
Adobe Employee ,
Jun 20, 2013 Jun 20, 2013

Copy link to clipboard

Copied

This should now be possible in Photoshop CC with the new multi-path selection capabilities.

Votes

Translate

Translate

Report

Report
LEGEND ,
Jun 20, 2014 Jun 20, 2014

Copy link to clipboard

Copied

This is freakin awesome! Thanks

Votes

Translate

Translate

Report

Report
LEGEND ,
Sep 21, 2015 Sep 21, 2015

Copy link to clipboard

Copied

I'm trying to adapt this script, but I need to keep several paths from deletion.
This is what I have (problem is the the indexOf....) :


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();

Votes

Translate

Translate

Report

Report
Community Expert ,
Mar 23, 2019 Mar 23, 2019

Copy link to clipboard

Copied

I just stumbled across this topic, beware the indiscriminate nature of the following script:

// Remove paths, alphas, layer comps, color samplers & guides
// https://forums.adobe.com/thread/1959150
// https://forums.adobe.com/message/7998834#7998834
#target photoshop
var doc = app.activeDocument;
 
// supress dialog windows
displayDialogs = DialogModes.NO
 
// delete ALL paths, including PathKinds of WORKPATH, NORMALPATH, CLIPPINGPATH & VECTORMASK
doc.pathItems.removeAll();
// delete ALL alphas, including SPOT CHANNELS
doc.channels.removeAll();
 
// delete layercomps
doc.layerComps.removeAll();
 
// delete color samplers
doc.colorSamplers.removeAll();
// delete guides
doc.guides.removeAll();
 

I’m not sure how to exclude SPOT CHANNELS or VECTOR MASKS or CLIPPING MASKS...

Votes

Translate

Translate

Report

Report
LEGEND ,
Mar 26, 2019 Mar 26, 2019

Copy link to clipboard

Copied



As a retoucher I use paths a lot. When my images are done I use Image Processor to export the images with a flatten action. After doing this I currently have to go into each image and delete all the paths individually on every image. It would be lovely if a "Delete All Paths" option would be available, so I also could record it do an action and process them out while drinking coffee.

Votes

Translate

Translate

Report

Report
Explorer ,
Mar 26, 2019 Mar 26, 2019

Copy link to clipboard

Copied

LATEST
Look a few posts above yours, scripting is the way to go.

Votes

Translate

Translate

Report

Report