Skip to main content
Participant
November 9, 2015
Answered

best way to add a CURVES Layer

  • November 9, 2015
  • 2 replies
  • 1339 views

Hi All,

I'm writing to you regarding the best way do add an ArtLayer with a script.

I already know that it is possible to add an Artlayer and then change the property layer.kind to TEXT.

But unfortunatly it isn't possible to add change this property to LayerKind.CURVES.


Here is an example

/**
* Function to add a layer to a Document
* @param {LayerKind} layer_kind, the type of the layer (CURVES, TEXT, SELECTIVECOLOR)
* @param {Document|LayerSet} [obj = app.activeDocument] the obj which contains the new layer
* @return {ArtLayer} layer the added layer
* @todo add a better test to check if layer_kind is an enum of LayerKind
* @toto add control the layer is background or not
* @todo https://forums.adobe.com/thread/1601245
*/
my.add = function (name, layer_kind, obj) {

   if (obj === undefined) {

   var obj = app.activeDocument;

  }

   if (typeof layer_kind !== 'object') {

   throw {

   name: 'InvalidArgumentError',

   message: 'you must enter a valid value for the param layer_kind [CURVES, TEXT, SELECTIVECOLOR, etc.]',

   fileName: $.fileName,

   lineNumber: $.line
   };

  }

   var layer = obj.artLayers.add();

   layer.kind = layer_kind;

   layer.name = name;

   return layer;

}

So the only way to add different type of layer is to use Action Script listener?

I'm a bit confused because it would be much better to be able to change the layer.kind property.

In advance, thanks you very much for your Help.
Best regard.

This topic has been closed for replies.
Correct answer JJMack

Do not forget your not dealing with Adobe here these are user forums.  If you want changes made to Photoshop scripting you need to address Adobe please use Photoshop Family Customer Community and submit a suggestion.

Adobe DOM is limited without Action Manager scripting code via ScriptListener Photoshop scripting would not be very useful because limited Adobe Photoshop DOM model methods. Many Photoshop features are not supported and the features supported may be supported in a limited way.

2 replies

JJMack
Community Expert
JJMackCommunity ExpertCorrect answer
Community Expert
November 9, 2015

Do not forget your not dealing with Adobe here these are user forums.  If you want changes made to Photoshop scripting you need to address Adobe please use Photoshop Family Customer Community and submit a suggestion.

Adobe DOM is limited without Action Manager scripting code via ScriptListener Photoshop scripting would not be very useful because limited Adobe Photoshop DOM model methods. Many Photoshop features are not supported and the features supported may be supported in a limited way.

JJMack
Participant
November 9, 2015

Thank you for your Help … Ok, I didn't know. The next time I will use the other forum.

Have a nice day.

JJMack
Community Expert
Community Expert
November 9, 2015

Be careful automating Adjustment layers. Adobe added options in the Adjustment panel they added in CS4.   These options can not be set or tested by a script  yet they may effect how an Adjustment layers are added.  These option act more like a preference but adjustment layer are also not always added the way these are set.


Adjustment Layer automation is a train wreck.  If you want a way to program around these Adobe bugs let me know.

JJMack
Chuck Uebele
Community Expert
Community Expert
November 9, 2015

You need to use Action Manager Code to create an adjustment layer, as you found out.