Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Could anyone please help me...

New Here ,
Mar 18, 2009 Mar 18, 2009
i would like to have a batch processing script or action for copying some clipping paths from pictures(have paths inside) to pictures(don't have). they are in the same name but difference location.

Folder A (Pic's name 1,2,3,4,...) ---- copy paths to-----> Folder B (Pic's name 1,2,3,4,...)

Thanks
TOPICS
Actions and scripting
680
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Mar 19, 2009 Mar 19, 2009
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 );

}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 19, 2009 Mar 19, 2009
LATEST
// This is Photoshop, so just call our DOM routine with the files
var fileArray = photoshop10.ExtractFileArray (files);

for (index = 0; index < fileArray.length; ++index)
{
var file = fileArray[index];

app.open (file); <<<<<< Cannot open the file because the open options are incorrect.

}

Regard ^.^ and thank you very muchhhhhhhhh
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines