I have a Photoshop script (Javascript) that copy paste paths from one image to another. It has worked for a long time, but after updating Photoshop to 2021 (22.1.0) on Windows 10, I get an error in this line where the selected path is copied,
executeAction( id122, undefined, DialogModes.ERROR );
Stripped down version of the script to copy clipping path from one image to another as follows (have to provide file paths to sourceFile and destinationFile variables in the first two lines), and it works with previous versions of Photoshop,
var sourceFile = new File("File path to source file"); // file path to image that has the clipping pathvar destinationFile = new File("File path to destination file"); // file path to image to which we want to copy the clipping path from source fileopen(sourceFile);open(destinationFile);var sourceDoc = documents[0];var destinationDoc = documents[1];activeDocument = sourceDoc;sourceDoc.pathItems[0].select(); //get the top most path from source filevar id122 = charIDToTypeID("copy");executeAction( id122, undefined, DialogModes.ERROR ); // copy the selected pathactiveDocument = destinationDoc;var id126 = charIDToTypeID( "past" );executeAction( id126, undefined, DialogModes.NO ); // paste the copied path to destination filesourceDoc.close(SaveOptions.DONOTSAVECHANGES); //close without any changesdestinationDoc.close(SaveOptions.SAVECHANGES); //save with changesalert("Done");sourceFile.close();destinationFile.close();
Inside Photoshop I get error pop up "The command 'copy' is not currently available"
In the ExtendScript toolkit debugger I get the error message "General Photoshop error occurred. This functionality may not be available in this version of Photoshop"
Everything works fine up to this line of code,
executeAction( id122, undefined, DialogModes.ERROR );
image with path is open in Photoshop and clipping path is selected as intended and the destination image also open. Variable id122 has an int value too.
Can you please check why this happens after updating to Photoshop 2021? It works fine with previous versions.
Thanks