Reply To: Apply Multiply Effect and Clipping Path then Group images.

#86534
Ari Singer
Member

Here’s the fixed script so that it pops up a dialog on each individual item when selected.

//Ari S. - designerjoe@outlook.com
app.scriptPreferences.enableRedraw = false;
// 'Undo' will undo the entire script
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Image Manipulation Script");

function main(){
	// Capture the current selections in array
    var mySelections = app.selection;
	for (var i = 0; i < mySelections.length; i++)
	{
		try {
			var bottomObject = mySelections[i];
			app.select(bottomObject);
			var paths = bottomObject.pageItems.item(0).clippingPath.photoshopPathNames;
			var myDialog = app.dialogs.add({name:"Select PSD Clipping Path", canCancel:true});
			with (myDialog) {
				with(dialogColumns.add()) {
					with(dialogRows.add()) {
						staticTexts.add ({staticLabel:"Select the clipping path that you want:"});
						with(dialogRows.add()) {
							var myPathDdl = dropdowns.add({minWidth:100});
							myPathDdl.stringList = paths;
							myPathDdl.selectedIndex = 0;
							}
						}
					}
				}

			if (myDialog.show() == true)
			{
				var topObject = bottomObject.duplicate();
				bottomObject.transparencySettings.blendingSettings.blendMode = BlendMode.MULTIPLY;
				topObject.pageItems.item(0).clippingPath.appliedPathName = topObject.pageItems.item(0).clippingPath.photoshopPathNames[myPathDdl.selectedIndex];
				topObject.pageItems.item(0).clippingPath.clippingType = ClippingPathType.PHOTOSHOP_PATH;
				bottomObject.pageItems.item(0).clippingPath.clippingType = ClippingPathType.NONE;
				var myGroup = bottomObject.parent.groups.add ([bottomObject, topObject]);
				app.select(myGroup);
				myDialog.destroy();
				}
			}
			catch (myError) {}
			}
		}

This article was last modified on July 14, 2016

Comments (0)

Loading comments...