Highlighted

clipping path script for selected images indesign

New Here ,
Apr 08, 2020

Copy link to clipboard

Copied

Hello everybody.

I'm looking for someone that might be able to help me with my inquiry – which might be as "easy" as adapting the following script.

I would need a script that automatically chooses the photoshop clipping mask for all SELECTED IMAGES IN INDESIGN.
The script I found comes pretty close but it automatically clips ALL images in a document which is almost what I want but it'd help me a lot if I would be able to choose the images I want to clip first and then run the script for only the selected images.

Is there anyone here that might be able to fix this Problem for me?

This is the script I found and tested:

var allImages = app.selection[0].allGraphics;
app.selection[0] = null;
l = allImages.length;
while(l--)
{
var currImage = allImages[l];
var pathName = currImage.clippingPath.photoshopPathNames[0];
if(pathName != undefined) currImage.clippingPath.appliedPathName = pathName;
}

 

THANKS SO MUCH

in advance my good JAVA-knowing-people ^^




 

hello, try this:

function main(){
	for(var i = 0; i < cur_obj.length; i++){
		try{
			if(typeof cur_obj[i].graphics[0].clippingPath.photoshopPathNames[0] != 'undefined'){
				cur_obj[i].graphics[0].clippingPath.appliedPathName = cur_obj[i].graphics[0].clippingPath.photoshopPathNames[0]
			}
		}
		catch(e){}
	}
}

try{var cur_obj = app.selection}
catch(e){exit()}

if(typeof cur_obj != 'undefined' && cur_obj.length != 0){
	app.doScript('main()', ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'clip')
}

 

Topics

Scripting

Views

163

Likes

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

clipping path script for selected images indesign

New Here ,
Apr 08, 2020

Copy link to clipboard

Copied

Hello everybody.

I'm looking for someone that might be able to help me with my inquiry – which might be as "easy" as adapting the following script.

I would need a script that automatically chooses the photoshop clipping mask for all SELECTED IMAGES IN INDESIGN.
The script I found comes pretty close but it automatically clips ALL images in a document which is almost what I want but it'd help me a lot if I would be able to choose the images I want to clip first and then run the script for only the selected images.

Is there anyone here that might be able to fix this Problem for me?

This is the script I found and tested:

var allImages = app.selection[0].allGraphics;
app.selection[0] = null;
l = allImages.length;
while(l--)
{
var currImage = allImages[l];
var pathName = currImage.clippingPath.photoshopPathNames[0];
if(pathName != undefined) currImage.clippingPath.appliedPathName = pathName;
}

 

THANKS SO MUCH

in advance my good JAVA-knowing-people ^^




 

hello, try this:

function main(){
	for(var i = 0; i < cur_obj.length; i++){
		try{
			if(typeof cur_obj[i].graphics[0].clippingPath.photoshopPathNames[0] != 'undefined'){
				cur_obj[i].graphics[0].clippingPath.appliedPathName = cur_obj[i].graphics[0].clippingPath.photoshopPathNames[0]
			}
		}
		catch(e){}
	}
}

try{var cur_obj = app.selection}
catch(e){exit()}

if(typeof cur_obj != 'undefined' && cur_obj.length != 0){
	app.doScript('main()', ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'clip')
}

 

Topics

Scripting

Views

164

Likes

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
Explorer ,
Apr 09, 2020

Copy link to clipboard

Copied

hello, try this:

function main(){
	for(var i = 0; i < cur_obj.length; i++){
		try{
			if(typeof cur_obj[i].graphics[0].clippingPath.photoshopPathNames[0] != 'undefined'){
				cur_obj[i].graphics[0].clippingPath.appliedPathName = cur_obj[i].graphics[0].clippingPath.photoshopPathNames[0]
			}
		}
		catch(e){}
	}
}

try{var cur_obj = app.selection}
catch(e){exit()}

if(typeof cur_obj != 'undefined' && cur_obj.length != 0){
	app.doScript('main()', ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'clip')
}

 

Likes

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
Reply
Loading...
New Here ,
Apr 09, 2020

Copy link to clipboard

Copied

Hello SychevKA,

 

It seems to work properly 🙂

Thank you so much!! Yay.

Cheers

Likes

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
Reply
Loading...