Skip to main content
jjwithers
Inspiring
April 9, 2011
Released

P: Ability to delete multiple paths

  • April 9, 2011
  • 66 replies
  • 1994 views

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.

66 replies

September 5, 2012
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
Paul Riggott
Inspiring
September 5, 2012
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 );
};

September 5, 2012
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
September 5, 2012
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
September 5, 2012
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.
Paul Riggott
Inspiring
September 5, 2012
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--;
}
}
September 5, 2012
Paul,
Thank you for the explanation and the script!!!
I've never made a script b4 & like Susan, wouldn't have known what to do with it.
I used Edward version only changed the name from Path 1 to Outlined, as the name of the path I need saved is renamed by an action to "Outlined". Your reply to Edward showed me what I needed to do differently in my situation. Thanks!

Paul... seeing that you are knowledgeable in writing scripts. Is it possible to add to your "delete paths" script to also have the same script delete all the extra channels in the channels palette?
If yes, may I ask if you would do that for me (us)?

Paul, it's folks like you that make the Photoshop forum a valuable asset. The exchange of ideas, solutions, helping others.

I'd still like Adobe to integrate this into the Paths fly-out menu, but this is a big help for now.

Noooo... don't close the thread yet,
I'd still like Adobe to integrate the ability to organize path names into sets / groups like the layers palette.

JeffN
Edward Caruso Photography
Participating Frequently
September 5, 2012
thank you very much Paul. I did this and it couldn't be easier - I guess we can close the thread now? If a simple script can take care of a task like this - I'd rather Adobe engineers spend time on something else (like my bezier curves warp tool idea!)
vaclavjesenicky
Participant
September 5, 2012
why ... scripts etc. i'm understand

i'm using PS from version 4.0 (PC) and i love it.

so. Adobe guys, WAKE UP, please make useful tool for professionals (i mean managing paths) and don't make same useless thinks for amateurs!
Paul Riggott
Inspiring
September 5, 2012
As Chris has said this is JavaScript.
Open ExtendScript Toolkit (this gets installed with Photoshop) copy and paste the code into a window then save the script to the application presets/scripts folder.
If Photoshop was open close and restart it.
To use: File - Scripts - select the script.
An action could be created to call the script by creating a new action, from the action pallete fly-out menu select Insert Menu Item, then File - Scripts - select the script. Stop recording.
The code could also be put behind a button in a Configurator panel.