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

Path Deletion Script

Explorer ,
Aug 31, 2009 Aug 31, 2009

Copy link to clipboard

Copied

i currently have a script which contains a line for deleting all of the channels in a tif file:

activeDocument.channels.removeAll()

and this works fine.  i would like to add the necessary code to also delete all of the paths in a file.  i tried adding the line: activeDocument.paths.removeAll() but i received an error message.

does anyone know the correct way to do this?  please advise.

thanks.

TOPICS
Actions and scripting

Views

1.8K

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

Advocate , Aug 31, 2009 Aug 31, 2009

John A Horner wrote:

thank you both so much for your replys.  it have incorporated your suggestions and the sript seems to be working fine.

i have one more related question: i notice that in some of the scripts i already have there is a semi-colon at the end of most of the lines but not all.  for example:

activeDocument.flatten();

activeDocument.channels.removeAll()

activeDocument.pathItems.removeAll();

does it make a difference one way or another?

finally, i am new to the forums and saw that i was onl

...

Votes

Translate

Translate
Adobe
Advocate ,
Aug 31, 2009 Aug 31, 2009

Copy link to clipboard

Copied

activeDocument.pathItems.removeAll()

NOTE - this will remove the path used as a mask for the currently selected layer, if one exists. You may want to loop through the collection and check to see if the path is a layer mask before deleting it.

Votes

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
Guru ,
Aug 31, 2009 Aug 31, 2009

Copy link to clipboard

Copied

If you have CS4 you can do something like this to make sure the activeLayer does not have a vector mask

try{
    activeDocument.activeLayer.vectorMaskDensity;
}catch(e){
    activeDocument.pathItems.removeAll();
}

Votes

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
Explorer ,
Aug 31, 2009 Aug 31, 2009

Copy link to clipboard

Copied

thank you both so much for your replys.  it have incorporated your suggestions and the sript seems to be working fine.

i have one more related question: i notice that in some of the scripts i already have there is a semi-colon at the end of most of the lines but not all.  for example:

activeDocument.flatten();

activeDocument.channels.removeAll()

activeDocument.pathItems.removeAll();

does it make a difference one way or another?

finally, i am new to the forums and saw that i was only able to give 1 correct answer or 2 helpful so i wasn't sure the correct protocol for situations where there are 2 apparantly correct solutions.  but now, even though i have 2 correct solutions, it shows up as only "possibly answered".  is there a way to edit this?  please let me know if there is a proper way to handle this on the forums.  thanks again for everything.

jh

Votes

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
Guru ,
Aug 31, 2009 Aug 31, 2009

Copy link to clipboard

Copied

As I understand it you should put a ; at the end of every statement but it's not required. Most of the time it seems the only difference is it makes debugging eaiser. Without the ; the wrong line may be reported as the source of the error.

As for the forum's point system. I don't know how to change it. If you can, give the correct answer to Mark. I just expaned on his post.

Mike

Votes

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
Explorer ,
Aug 31, 2009 Aug 31, 2009

Copy link to clipboard

Copied

thanks mike.

mark, if you repost your original post i can mark it as the correct solution (unfortunatley, i can't find a way to revise my "scoring" of the original post)

Votes

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
Advocate ,
Aug 31, 2009 Aug 31, 2009

Copy link to clipboard

Copied

John A Horner wrote:

thank you both so much for your replys.  it have incorporated your suggestions and the sript seems to be working fine.

i have one more related question: i notice that in some of the scripts i already have there is a semi-colon at the end of most of the lines but not all.  for example:

activeDocument.flatten();

activeDocument.channels.removeAll()

activeDocument.pathItems.removeAll();

does it make a difference one way or another?

finally, i am new to the forums and saw that i was only able to give 1 correct answer or 2 helpful so i wasn't sure the correct protocol for situations where there are 2 apparantly correct solutions.  but now, even though i have 2 correct solutions, it shows up as only "possibly answered".  is there a way to edit this?  please let me know if there is a proper way to handle this on the forums.  thanks again for everything.

jh

If you are flattening the document first, then the warning about deleting vector masks for the current layer won't apply to you, you are good to removeAll.

From what I remember, adding the ';' at the end of each line is 'proper' javascript, and I believe was once required. It often doesn't matter from what I've seen (I am often lazy and forget/neglect to use it myself) as many scripts will run just fine whether it is there or not. I believe it still is required in certain circumstances, although I am not completely sure what they are.

I don't know how the Adobe system uses it's points, not sure what to tell you on that.

Votes

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
Community Expert ,
Feb 04, 2021 Feb 04, 2021

Copy link to clipboard

Copied

LATEST

I just stumbled over this old topic, the following script has "fine tuned" path removal options:

 

Free script: Remove Selected

 

Votes

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