5 Replies Latest reply on Jul 27, 2010 5:12 PM by gmitchel

    Photoshop CS5 Action Manager Not Responding


      I've been trying to port CS4 panels to CS5. The code below compiles without an error. It runs without throwing a runtime error. However, every call to the action manager causes the code to stop. Comment out the action manager code and everything runs.


      I also notice that the mx.Alert does not open an alert dialog. It causes the same issue. The code stops.


      This code works flawlessly with CS4.


      Any suggestions would be very welcome!






      private function makeLuminosityEdgeMask(maskWidth:int):void {


      try {



      var docRef : Document = Photoshop.app.activeDocument;


      var docRef2 : Document = docRef.duplicate( "Duplicate" );



      var docName : String = docRef.name;


      docRef2.bitsPerChannel = BitsPerChannelType.EIGHT;





      var myArtLayer: ArtLayer = ArtLayer(docRef2.activeLayer);



      // Blur photo prior to mask generation for wide and medium width masks



      switch (maskWidth) {


      case maskWidthMediumEdges: myArtLayer.applyGaussianBlur(1.0); break;


      case maskWidthWideEdges: myArtLayer.applyGaussianBlur(3.0); break;


      default: break;




      // Run the Find Edges filter



      var idFndE:Number = Photoshop.app.charIDToTypeID( "FndE" );

      Photoshop.app.executeAction( idFndE,

      null, DialogModes.NO );



      // Invert result of Find Edges filter





      // Apply curves adjustment



      var curvesShape:Array = new Array(new Array(20,0),


      new Array(60,120),


      new Array(90,180),


      new Array(145,225),


      new Array(255,255));




      // Apply maximum filter



      switch (maskWidth) {


      case maskWidthMediumEdges: myArtLayer.applyMaximum(1.0); break;


      case maskWidthWideEdges: myArtLayer.applyMaximum(2.0); break;


      default: break;




      // Apply median filter



      switch (maskWidth) {


      case maskWidthMediumEdges: myArtLayer.applyMedianNoise(1.0); break;


      case maskWidthWideEdges: myArtLayer.applyMedianNoise(2.0); break;


      default: break;




      // Apply Gaussian Blur



      switch (maskWidth) {


      case maskWidthExtraNarrowEdges: myArtLayer.applyGaussianBlur(0.1); break;


      case maskWidthNarrowEdges: myArtLayer.applyGaussianBlur(0.5); break;


      case maskWidthMediumEdges: myArtLayer.applyGaussianBlur(1.0); break;


      case maskWidthWideEdges: myArtLayer.applyGaussianBlur(2.0); break;


      default: break;




      // Apply AutoLevels to Mask





      // Duplicate channel and rename



      var channelName:String;



      switch (maskWidth) {


      case maskWidthExtraNarrowEdges: channelName = maskLuminosityEdgesExtraNarrow; break;


      case maskWidthNarrowEdges: channelName = maskLuminosityEdgesNarrow; break;


      case maskWidthMediumEdges: channelName = maskLuminosityEdgesMedium; break;


      case maskWidthWideEdges: channelName = maskLuminosityEdgesWide; break;




      // Duplicate channel to original document



      var idDplc:int = Photoshop.app.charIDToTypeID( "Dplc" );


      var desc2:ActionDescriptor = new ActionDescriptor();


      var idnull:int = Photoshop.app.charIDToTypeID( "null" );


      var ref1:ActionReference = new ActionReference();


      var idChnl:int = Photoshop.app.charIDToTypeID( "Chnl" );


      var idOrdn:int = Photoshop.app.charIDToTypeID( "Ordn" );


      var idTrgt:int = Photoshop.app.charIDToTypeID( "Trgt" );

      ref1.putEnumerated( idChnl, idOrdn, idTrgt );

      desc2.putReference( idnull, ref1 );


      var idT:int = Photoshop.app.charIDToTypeID( "T " );


      var ref2:ActionReference = new ActionReference();


      var idDcmn:int = Photoshop.app.charIDToTypeID( "Dcmn" );

      ref2.putName( idDcmn, docName );

      desc2.putReference( idT, ref2 );


      var idNm:int = Photoshop.app.charIDToTypeID( "Nm " );

      desc2.putString( idNm, channelName );

      Photoshop.app.executeAction( idDplc, desc2, DialogModes.NO );



      // Close duplicate





      // Release RAM;




      // Refresh app




      // Restore Channels palette

      docRef.activeChannels = docRef.componentChannels;



      catch(error:Error) {


      "Error in makeLuminosityEdgeMask(): " + error.message);