Skip to main content
Known Participant
December 26, 2020

P: Script not working after updating

  • December 26, 2020
  • 15 replies
  • 2136 views

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

This topic has been closed for replies.

15 replies

Participating Frequently
March 24, 2021

Yes, the delay is frustrating.  I wonder now if it was actually resolved in 22.1.1 or 22.2.  

A safer alternative to cut/paste for paths would be to 

  1. Create a new layer
  2. Create a vector mask from the path
  3. Duplicate that layer to the destination
  4. In the destination doc, duplicate the vector mask to a new path
  5. Delete the new layer
  6. Rename the path if desired

I will also see if duplicating paths to another document (like layers) is in that team's backlog.

Known Participant
March 24, 2021

I mentioned the version I am using in the question three months ago.

Script works with the latest PS version 22.3

Participating Frequently
March 23, 2021

I finally got the error by downgrading to 22.1.0.  I could file a bug, but I expect the team would simply close it as fixed in 22.3.

Please try with 22.3.  I did not see the error there.

Known Participant
March 23, 2021

Can we please escalate this as it has been almost three months?

Thanks

Known Participant
March 16, 2021

@SamGannaway Also I am not sure it has anything to do with the images, when I run the script on any image with PS 2018, it works fine.

And I tried with many images on PS 2021, script crashes on all of them.

Source files have only Background layer and one path, destination file is the same without a path. Thanks

Known Participant
March 15, 2021

@SamGannaway Is there a way to send you sample files without posting here?

Participating Frequently
March 12, 2021

@Asela Sandaruwan I have not yet been able to reproduce the issue here.  Would you please describe in detail the structure of the file from which the path is copied or provide a sample file?

 

Known Participant
March 2, 2021

Any updates / solution for this issue?

Thanks

Known Participant
February 16, 2021

I tried your suggestion, manual shortcuts and menu copy / paste works fine, without errors.

Thanks

Participating Frequently
January 7, 2021

Hmm, since we're invoking the "copy" command, I still believe the issue is one of the app state.  Until I can replicate, would you try the following to help identify the app state characteristic:

  • Run the script up to the copy command. Try using the keyboard short cut or menu to execute the copy.  
  • Manually execute the steps of the script.

Hopefully, you'll get an error or the path will fail to copy.

"The command 'copy' is not currently available" error should correspond with the menu item Edit > Copy being disabled.