Reply To: Cut photo in half along curved path

Home Page / Forums / General InDesign Topics (CLOSED) / Cut photo in half along curved path / Reply To: Cut photo in half along curved path

#85857
Matt Isaac
Participant

Yeah i tried to work the try/catch block into my script but without copy/pasting yours i couldn’t get it to work so i just went with what i knew. I will experiment with try/catch and eventually get the hang of it.
—–
Turns out the try/catch statement works just as the if/else statement.
—–
Here is my updated script:

//Scripted by Skemicle
//with assistance from Ari S
if (parseFloat(app.version) < 6)
main();
else
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Splice Image Along Path");
function main() {
	try{
		var sel = app.selection;
		var orig = sel[0];
		var path = sel[1];
		var top = sel[0].duplicate();
		path.subtractPath(top);
		var half1 = top.duplicate();
		top.subtractPath(orig);
		app.selection = null;
	}
	catch(error){
		alert("Please, make sure you have selected an image and an overlapping path.");
	}
}

Thanks for your assistance Ari.

This article was last modified on June 17, 2016

Comments (0)

Loading comments...