This should work:
//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;
// Capture all the paths from the selected PSD
try {
var paths = mySelections[0].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;
}
}
}
}
}
catch(myError) {
alert("Make sure it's a PSD");
exit();
}
if (myDialog.show() == true) {
for (var i = 0; i < mySelections.length; i++) {
try{
var bottomObject = mySelections[i];
var topObject = bottomObject.duplicate();
bottomObject.transparencySettings.blendingSettings.blendMode = BlendMode.MULTIPLY;
try {
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;
try {
var myGroup = bottomObject.parent.groups.add ([bottomObject, topObject]);
app.select(myGroup);
}
catch (myError) {
// If it can't group
alert("could not group successfully");
}
}
catch (myError) {
// If it can't apply the Photoshop path then it obviously does not have one
alert("Selected image does not have a Photoshop path applied")
}
}
catch (myError){
// If it can't duplicate the object or apply multiply then it's obviously not a graphic frame
alert("Make sure you selected a graphic frame");
}
}
}
myDialog.destroy();
}