First: The headline to Your query is not very informative, a more specific definition of topic would seem a better choice.
Secondly: I havent tested it extensively and Im not very experienced with Scripting, but You could give this a try:
// this script tries to copy the clipping paths of files in one folder into files of the same name in another folder;
// use it at your own risk;
#target photoshop
var withPath = Folder.selectDialog("select the folder containing the images with paths");
var withoutPath = Folder.selectDialog("select the folder containing the images without paths");
if (!withPath || !withoutPath) {}
else {
var theOnesWith = withPath.getFiles();
var theOnesWithout = withoutPath.getFiles();
var notFound = new Array;
for (var m = 0; m < theOnesWith.length; m++) {
var checksOut = false;
theOne = theOnesWith ;
for (var n = 0; n < theOnesWithout.length; n++) {
theOtherOne = theOnesWithout ;
// compare file-names;
if (theOne.name.slice(theOne.name.lastIndexOf("/")+1,-4) == theOtherOne.name.slice(theOtherOne.name.lastIndexOf("/")+1,-4)) {
checksOut = true;
photoshop.open(theOtherOne);
var theUnpathed = app.activeDocument;
photoshop.open(theOne);
var thePathed = app.activeDocument;
for (var o = 0; o < thePathed.pathItems.length; o++) {
app.activeDocument = thePathed;
var aPath = thePathed.pathItems ;
// look for clipping path;
if (aPath.kind == PathKind.CLIPPINGPATH) {
aPath.select();
copyPath (thePathed, theUnpathed, aPath.name);
app.activeDocument = theUnpathed;
theUnpathed.pathItems[theUnpathed.pathItems.length-1].makeClippingPath(1)
}
else {}
}
}
else {};
try {
thePathed.close(SaveOptions.PROMPTTOSAVECHANGES);
theUnpathed.close(SaveOptions.PROMPTTOSAVECHANGES);
// for automatic saving clear previous line and remove the two slashes in the following line;
// theUnpathed.close(SaveOptions.SAVECHANGES);
}
catch (e) {};
}
if (checksOut == false) {
notFound = notFound.concat(theOne.name.slice(theOne.name.lastIndexOf("/")+1,-4))
}
else {}
};
if (notFound.length > 0) {
alert ("no corresponding file/s in the second folder found for \n" + notFound.join("\n"))
}
};
////// by nic bereznikov //////
function copyPath( From, To, PathName) {
// Select source document
activeDocument = From;
// define function
cTID = function(s) { return app.charIDToTypeID(s); };
// Select path
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putName( cTID( "Path" ), PathName);
desc.putReference( cTID( "null" ), ref );
executeAction( cTID( "slct" ), desc, DialogModes.NO );
// Copy path
executeAction( cTID( "copy" ), undefined, DialogModes.NO );
// Select destination document
activeDocument = To;
// Paste path
executeAction( cTID( "past" ), undefined, DialogModes.NO );
// Deselect path
//desc.putReference( cTID( "null" ), ref );
//executeAction( cTID( "Dslc" ), desc, DialogModes.NO );
}
... View more