Skip navigation
gmitchel
Currently Being Moderated

[CS5, ActionScript, and Nulls

Aug 3, 2010 8:00 AM

CS4 worked fine with nulls and null pointers. CS5 does not appear to like them at all.

 

The ScriptUI tool writes code that includes nulls. When it runs, I get an error about an unsupported feature.

 

Here is an example:

 

 

private function applyNormalBlendToSmartFilterEffect():void {

 

try {

 

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

 

     var desc13:ActionDescriptor = new ActionDescriptor();

 

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

 

     var ref6:ActionReference = new ActionReference();

 

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

     ref6.putIndex( idfilterFX, 1 );

 

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

 

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

 

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

     ref6.putEnumerated( idLyr, idOrdn, idTrgt );

     desc13.putReference( idnull, ref6 );

 

     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" );

     desc15.putUnitDouble( idOpct, idPrc, 100.000000 );

 

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

 

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

 

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

     desc15.putEnumerated( idMd, idBlnM, idDrkn );

     desc14.putObject( idblendOptions, idblendOptions, desc15 );

     desc13.putObject( idfilterFX, idfilterFX, desc14 );

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

}

 

catch(error:Error) {

     Alert.show(

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

}

}

 

This code will not run. Although, it compiles just fine.It runs fine in Photoshop CS4, too.

 

Anyone have a suggestion for passing a null with AS in a situation like this:

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

 

Thanks in advance,

 

Mitch

 

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