Skip to main content
Inspiring
November 8, 2023
Answered

How to sure that all paths are deselected

  • November 8, 2023
  • 2 replies
  • 449 views

I create some javascript for PS but it failed if some path is selectrd/active, how to prevent this and to be sure that all paths are deselceted=inactive? 

 

This topic has been closed for replies.
Correct answer GNDGN

This does the job:

for(i=0; i<app.activeDocument.pathItems.length; i++) {
	app.activeDocument.pathItems[i].deselect();	
}

2 replies

GNDGN
GNDGNCorrect answer
Inspiring
November 8, 2023

This does the job:

for(i=0; i<app.activeDocument.pathItems.length; i++) {
	app.activeDocument.pathItems[i].deselect();	
}
____________________Robotic Process Automation in Desktop Publishing (Book): https://doi.org/10.1007/978-3-658-39375-5
milevicAuthor
Inspiring
November 8, 2023

Thanks guys

Stephen Marsh
Community Expert
Community Expert
November 8, 2023

You're welcome!

Stephen Marsh
Community Expert
Community Expert
November 8, 2023

@milevic 

 

Here is a function to deselect all paths:

 

deselectPaths();

function deselectPaths() {
	function s2t(s) {
		return app.stringIDToTypeID(s);
	}
	var descriptor = new ActionDescriptor();
	var reference = new ActionReference();
	reference.putEnumerated( s2t( "path" ), s2t( "ordinal" ), s2t( "targetEnum" ));
	descriptor.putReference( s2t( "null" ), reference );
	executeAction( s2t( "deselect" ), descriptor, DialogModes.NO );
}