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.
...
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
Copy link to clipboard
Copied
activeDocument.pathItems.removeAll()
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();
}
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
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
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)
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.
Copy link to clipboard
Copied
I just stumbled over this old topic, the following script has "fine tuned" path removal options: