0 Replies Latest reply on May 4, 2012 3:15 AM by PhotoSì

    Problem with operations on photoshop layers

    PhotoSì Level 1

      I have a problem when I try to do some operations on the layouts like resize and rotate.

       

      To reproduce the problem follow these steps.

       

      Create a new creative suit extension project, select adobe Photoshop extended as csaw libraries.

      In the testPhotoshop.run function put this code:

       

      var app:Application = Photoshop.app;            
      var doc:Document = app.activeDocument;
      doc.resizeImage(200, 150);
      var l:ArtLayer = doc.artLayers.add();
      l.isBackgroundLayer = true;
      doc.artLayers.index(0).resize(50, 50);
      doc.artLayers.index(1).translate(10, 10);
      doc.artLayers.index(2).translate(10, 10);
      

       

      Start debugging, open an image with 3 layers and click 'Run PS code'.

       

      On mac all works fine.

      On windows an error is thrown on the resize operation and Photoshop go back one step in history.

      (the error text I got is in Italian, my translation follow, but may be inaccurate)

       

      Error:  Si è verificato un errore generale di Photoshop. La funzionalità richiesta potrebbe non essere disponibile in questa versione di Photoshop.

      - Impossibile trasformare perché il rettangolo di selezione iniziale è vuoto.

          at flash.external::HostObject/__call()

          at com.adobe.csawlib::CSHostObject/hostCall()

          at com.adobe.photoshop::Layer/resize()

          at testPhotoshop$/run()[F:\test\src\testPhotoshop.as:15]

          at test/___test_Button1_click()[F:\test\src\test.mxml:12]

       

      (translation)

      Error: General Photoshop error occurred. Required functionality could not be available in this Photoshop version.

      - Could not transform because the initial bounding rectangle is empty.

       

      If I put a breakpoint on the first line of code, and when hit I press resume (F8), the code work even on windows.

       

      What I have done wrong?