Skip navigation
Currently Being Moderated

Smart Filter Layers and Snow Leopard

Nov 30, 2010 1:48 PM

I posted this in the Photoshop API forum and got no response. Maybe I'll have better luch here.

 

I have several ActionScript wrappers for Javascript code generated by the ScriptListener plug-in that manipulate Smart Filter layers. The code runs without any error under Windows. With Snow Leopard, it generates errors about the Set and Delete commands not being available for the smart Filter layers.

 

Suggestions about this would be appreciated.

 

Code samples follow.

 

Mitch

 

 

This code generates an error stating the "Set" command is not available:

private function applyNormalBlendToSmartFilterEffect():void {

 

 

 

     try {

 

          var idsetd:int = Photoshop.app.charIDToTypeID( "setd" );

 

          var desc13:ActionDescriptor = new ActionDescriptor();

 

          var idnull:int = new int;

 

          var ref6:ActionReference = new ActionReference();

 

          var idfilterFX:int = Photoshop.app.stringIDToTypeID( "filterFX" );

 

          var idLyr:int = Photoshop.app.charIDToTypeID( "Lyr " );

 

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

 

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

 

          var desc14:ActionDescriptor = new ActionDescriptor();

 

          var idblendOptions:int = Photoshop.app.stringIDToTypeID( "blendOptions" );

 

          var desc15:ActionDescriptor = new ActionDescriptor();

 

          var idOpct:int = Photoshop.app.charIDToTypeID( "Opct" );

 

          var idPrc:int = Photoshop.app.charIDToTypeID( "#Prc" );

 

          var idMd:int = Photoshop.app.charIDToTypeID( "Md " );

 

          var idBlnM:int = Photoshop.app.charIDToTypeID( "BlnM" );

 

          var idDrkn:int = Photoshop.app.charIDToTypeID( "Nrml" );

 

     catch(error:Error) {

 

"Error in applyNormalBlendToSmartFilterLayer(): " + error.message, "Error!", Alert.OK, Sprite(mx.core.Application.application));

 

 

 

This code generates an error stating the Delete command is not available.

 

 

private function deleteLayerEffectsMask():void {

 

     try {

 

          var idDlt:int = Photoshop.app.charIDToTypeID( "Dlt " );

 

          var desc3:ActionDescriptor = new ActionDescriptor();

 

          var idnull:int = new int;

 

          var ref2:ActionReference = new ActionReference();

 

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

 

          var idfilterMask:int = Photoshop.app.stringIDToTypeID( "filterMask" );

 

     catch(error:Error) {

 

"Error in deleteLayerEffectsMask(): " + error.message, "Error!", Alert.OK, Sprite(mx.core.Application.application));

 

 

     }

}

          Alert.show(

               ref2.putEnumerated( idChnl, idChnl, idfilterMask );

               desc3.putReference( idnull, ref2 );

          Photoshop.app.executeAction( idDlt, desc3, DialogModes.NO );

     }

 

 

 

 

 

 

 

 

     }

 

}

 

          Alert.show(

               desc15.putEnumerated( idMd, idBlnM, idDrkn );

               desc14.putObject( idblendOptions, idblendOptions, desc15 );

               desc13.putObject( idfilterFX, idfilterFX, desc14 );

          Photoshop.app.executeAction( idsetd, desc13, DialogModes.NO );

     }

 

 

 

               desc15.putUnitDouble( idOpct, idPrc, 100.000000 );

 

 

 

 

 

               ref6.putEnumerated( idLyr, idOrdn, idTrgt );

               desc13.putReference( idnull, ref6 );

 

 

 

               ref6.putIndex( idfilterFX, 1 );

 

 

 

 

 

 

 

 
Replies
  • Currently Being Moderated
    Dec 1, 2010 11:14 AM   in reply to gmitchel

    I can't say I've run your code, but any discrepancy between Windows and Mac in Photoshop makes me think of the issue Bob has described here: http://cookbooks.adobe.com/post_Creative_Suite_5_Extensions_and_Photos hop_CS5_Redu-17727.html

     

    Have you given that a shot?

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 18, 2010 10:47 PM   in reply to gmitchel

    Hi Mitch,

     

    I don't have an answer for you as to why that's happening. I'll play with it a bit next week.

     

    In the meantime, what happens when you put the script listener code in ExtendScript and call it from

     

    CSXSInterface.getInstance().evalScript()??

     

     

    Bob

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 19, 2010 7:28 AM   in reply to gmitchel

    Mitch,

     

    I have found one other ActionDescriptor that doesn't work. That one was undocumented, so I didn't worry too much about it (things like that can change on you). That you might have found another makes me want to take a deeper look.

     

    Everything I've tried in the past as ES has worked, so I think you should have a viable workaround. I am going to try your code behind the workaround for the Mac/PS event bug just to see what happens.

     

    Regards

     

    Bob

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 19, 2010 8:52 AM   in reply to gmitchel

    gmitchel wrote:

     

    Thans, Bob.

     

    I have avoided EvalScript from CSXS out of concern for performance. Plus it means a separate script file for each function.

    There's no noticeable performance hit that I've seen.

     

    You do not need separate scripts. You can create one script with all the functions you need and load it up when you create your panel. You can then run ExtendScript functions as easily as ActionScript ones using HostObject. Read Zak's post here: http://cookbooks.adobe.com/post_Communicating_between_JavaScript_and_t he_CS_SDK_us-17383.html

     

    It's possible to use CSXSInterface.evalScript() as well, but HostObject is way better.

     

    Harbs

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 20, 2010 10:32 AM   in reply to gmitchel

    Mitch,

     

    Could you email or post a photoshop file that has content that will support those calls (along with what layers and whatnot need to be selected for the calls to be valid)? email: bostucky@adobe.com

     

    Thanks

     

    Bob

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 24, 2011 6:29 AM   in reply to gmitchel

    Mitch -

     

    I never received any samples

     

    Bob

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 8, 2011 9:05 AM   in reply to gmitchel

    I'm getting the same error on Snow Leopard any way I try it (AS or ES).

     

    I've got another customer reporting a similar error (command "X" not available), but only sporadically. But that one's on a Save command, and in both  Win & Mac.

     

    At this point, I don't know what to tell you other than I'll file a bug on it...

     

     

    Bob

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 8, 2011 10:01 AM   in reply to Bob Stucky

    Perhaps I spoke too soon. I went back to look at it - I had a small error in the jsx.

     

    This approach just worked for me on Snow Leopard...

     


    The attached files, main.jsx is your TLRProCaptureSharpening.mxml, renamed (Extension Builder defaults to main.mxml) and modified to call the jsx. SmartFilterEffect.jsx contains your two erroring functions converted to jsx. Place it in the src folder.

     

    Give it a try!

     

    Bob

    Attachments:
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points