0 Replies Latest reply on Apr 25, 2012 8:37 AM by MSSDedalus

    Copy and paste issue

    MSSDedalus

      While trying to create a simple copy and paste function ( from one open document / image into another open document in Photoshop CS5 ) like:

       

      PsApp.bringToFront();

      PsApp.activeDocument.selection.selectAll();

      PsApp.activeDocument.selection.copy();

      PsApp.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

      PsApp.activeDocument.paste();

      //more code to work with the pasted image 

       

      I have noticed that many times it doesn't paste the image and the next code throws unexpected results, but if I run it in debug mode and place a breakpoint just after calling the function ( like forcing a pause) then it runs fine.

       

      Tried also with scripting listener code, both in flex and Java with the same result; this also happens with a File - place script.

       

      I tried to insert a loop at the end of the process checking if the number of layers have increased after the paste call, and they actually increase but the image is not pasted

       

      For some reason it seems that the clipboard is not working as expected when the process is fast ¿?. Have also tried to clear the clipboard and to purge with no luck.

       

      I have had similar issues with Java scripting before but they were solved using the listener code instead, but it doesn't works now. Other users have the same problem but haven't found a solution.

       

      I'm using CS5 and Extension Builder 1.5.0.2 with Flash Builder 4.5.1