//
// Generated Tue Feb 17 2015 15:30:30 GMT+0600
//

//
//==================== Return Pigment ==============
//
function ReturnPigment() {
  // Make
  function step1(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putClass(PSString.layerGroup);
    desc1.putReference(PSString.Null, ref1);
    executeAction(PSEvent.Make, desc1, dialogMode);
  };

  // Set
  function step2(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    var desc2 = new ActionDescriptor();
    desc2.putEnumerated(PSKey.Color, PSKey.Color, PSEnum.Blue);
    desc1.putObject(PSKey.To, PSClass.Layer, desc2);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Select
  function step3(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Channel, PSClass.Channel, PSEnum.RGB);
    desc1.putReference(PSString.Null, ref1);
    desc1.putBoolean(PSKey.MakeVisible, false);
    executeAction(PSEvent.Select, desc1, dialogMode);
  };

  // Set
  function step4(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    var desc2 = new ActionDescriptor();
    desc2.putString(PSKey.Name, "Skin Pigment");
    desc1.putObject(PSKey.To, PSClass.Layer, desc2);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Make
  function step5(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putClass(PSClass.Layer);
    desc1.putReference(PSString.Null, ref1);
    executeAction(PSEvent.Make, desc1, dialogMode);
  };

  // Set
  function step6(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    var desc2 = new ActionDescriptor();
    desc2.putString(PSKey.Name, "5 px");
    desc1.putObject(PSKey.To, PSClass.Layer, desc2);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Set
  function step7(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    var desc2 = new ActionDescriptor();
    desc2.putEnumerated(PSKey.Mode, PSType.BlendMode, PSEnum.Multiply);
    desc1.putObject(PSKey.To, PSClass.Layer, desc2);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Reset
  function step8(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putProperty(PSKey.Color, PSKey.Colors);
    desc1.putReference(PSString.Null, ref1);
    executeAction(PSEvent.Reset, desc1, dialogMode);
  };

  // Exchange
  function step9(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putProperty(PSKey.Color, PSKey.Colors);
    desc1.putReference(PSString.Null, ref1);
    executeAction(PSEvent.Exchange, desc1, dialogMode);
  };

  // Fill
  function step10(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    desc1.putEnumerated(PSKey.Using, PSType.FillContents, PSEnum.ForegroundColor);
    desc1.putUnitDouble(PSKey.Opacity, PSUnit.Percent, 100);
    desc1.putEnumerated(PSKey.Mode, PSType.BlendMode, PSEnum.Normal);
    executeAction(PSEvent.Fill, desc1, dialogMode);
  };

  // Add Noise
  function step11(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    desc1.putEnumerated(PSKey.Distribution, PSKey.Distribution, PSEnum.GaussianDistribution);
    desc1.putUnitDouble(PSKey.Noise, PSUnit.Percent, 15);
    desc1.putBoolean(PSKey.Monochromatic, true);
    desc1.putInteger(PSKey.FilterLayerRandomSeed, 2533976);
    executeAction(sTID('addNoise'), desc1, dialogMode);
  };

  // Transform
  function step12(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    desc1.putEnumerated(PSKey.FreeTransformCenterState, PSType.QuadCenterState, PSEnum.QCSAverage);
    var desc2 = new ActionDescriptor();
    desc2.putUnitDouble(PSKey.Horizontal, PSUnit.Pixels, -0.5);
    desc2.putUnitDouble(PSKey.Vertical, PSUnit.Pixels, -0.5);
    desc1.putObject(PSKey.Offset, PSKey.Offset, desc2);
    desc1.putUnitDouble(PSKey.Width, PSUnit.Percent, 228.857142857143);
    desc1.putUnitDouble(PSKey.Height, PSUnit.Percent, 228.863636363636);
    desc1.putEnumerated(PSKey.Interpolation, PSType.Interpolation, PSEnum.Bicubic);
    executeAction(PSEvent.Transform, desc1, dialogMode);
  };

  // Set
  function step13(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putProperty(PSClass.Channel, PSString.selection);
    desc1.putReference(PSString.Null, ref1);
    desc1.putEnumerated(PSKey.To, PSType.Ordinal, PSEnum.None);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Duplicate
  function step14(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    desc1.putInteger(PSClass.Version, 5);
    executeAction(PSEvent.Duplicate, desc1, dialogMode);
  };

  // Set
  function step15(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    var desc2 = new ActionDescriptor();
    desc2.putString(PSKey.Name, "10 px");
    desc1.putObject(PSKey.To, PSClass.Layer, desc2);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Set
  function step16(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    var desc2 = new ActionDescriptor();
    desc2.putEnumerated(PSKey.Mode, PSType.BlendMode, PSEnum.Multiply);
    desc1.putObject(PSKey.To, PSClass.Layer, desc2);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Set
  function step17(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    var desc2 = new ActionDescriptor();
    desc2.putUnitDouble(PSKey.Opacity, PSUnit.Percent, 70);
    desc1.putObject(PSKey.To, PSClass.Layer, desc2);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Set
  function step18(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putProperty(PSClass.Channel, PSString.selection);
    desc1.putReference(PSString.Null, ref1);
    desc1.putEnumerated(PSKey.To, PSType.Ordinal, PSEnum.All);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Transform
  function step19(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    desc1.putEnumerated(PSKey.FreeTransformCenterState, PSType.QuadCenterState, PSEnum.QCSAverage);
    var desc2 = new ActionDescriptor();
    desc2.putUnitDouble(PSKey.Horizontal, PSUnit.Pixels, 0.5);
    desc2.putUnitDouble(PSKey.Vertical, PSUnit.Pixels, 0);
    desc1.putObject(PSKey.Offset, PSKey.Offset, desc2);
    desc1.putUnitDouble(PSKey.Width, PSUnit.Percent, 216.223958333333);
    desc1.putUnitDouble(PSKey.Height, PSUnit.Percent, 216.215277777778);
    desc1.putEnumerated(PSKey.Interpolation, PSType.Interpolation, PSEnum.Bicubic);
    executeAction(PSEvent.Transform, desc1, dialogMode);
  };

  // Set
  function step20(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putProperty(PSClass.Channel, PSString.selection);
    desc1.putReference(PSString.Null, ref1);
    desc1.putEnumerated(PSKey.To, PSType.Ordinal, PSEnum.None);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Duplicate
  function step21(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    desc1.putInteger(PSClass.Version, 5);
    executeAction(PSEvent.Duplicate, desc1, dialogMode);
  };

  // Set
  function step22(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    var desc2 = new ActionDescriptor();
    desc2.putString(PSKey.Name, "15 px");
    desc1.putObject(PSKey.To, PSClass.Layer, desc2);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Set
  function step23(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    var desc2 = new ActionDescriptor();
    desc2.putEnumerated(PSKey.Mode, PSType.BlendMode, PSEnum.Multiply);
    desc1.putObject(PSKey.To, PSClass.Layer, desc2);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Set
  function step24(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    var desc2 = new ActionDescriptor();
    desc2.putUnitDouble(PSKey.Opacity, PSUnit.Percent, 70);
    desc1.putObject(PSKey.To, PSClass.Layer, desc2);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Set
  function step25(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putProperty(PSClass.Channel, PSString.selection);
    desc1.putReference(PSString.Null, ref1);
    desc1.putEnumerated(PSKey.To, PSType.Ordinal, PSEnum.All);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Transform
  function step26(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    desc1.putEnumerated(PSKey.FreeTransformCenterState, PSType.QuadCenterState, PSEnum.QCSAverage);
    var desc2 = new ActionDescriptor();
    desc2.putUnitDouble(PSKey.Horizontal, PSUnit.Pixels, 0);
    desc2.putUnitDouble(PSKey.Vertical, PSUnit.Pixels, 0);
    desc1.putObject(PSKey.Offset, PSKey.Offset, desc2);
    desc1.putUnitDouble(PSKey.Width, PSUnit.Percent, 192.5);
    desc1.putUnitDouble(PSKey.Height, PSUnit.Percent, 192.5);
    desc1.putEnumerated(PSKey.Interpolation, PSType.Interpolation, PSEnum.Bicubic);
    executeAction(PSEvent.Transform, desc1, dialogMode);
  };

  // Set
  function step27(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putProperty(PSClass.Channel, PSString.selection);
    desc1.putReference(PSString.Null, ref1);
    desc1.putEnumerated(PSKey.To, PSType.Ordinal, PSEnum.None);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Set
  function step28(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putProperty(PSClass.Channel, PSString.selection);
    desc1.putReference(PSString.Null, ref1);
    desc1.putEnumerated(PSKey.To, PSType.Ordinal, PSEnum.All);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Layer Via Copy
  function step29(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    executeAction(sTID('copyToLayer'), undefined, dialogMode);
  };

  // Set
  function step30(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    var desc2 = new ActionDescriptor();
    desc2.putString(PSKey.Name, "20 px");
    desc1.putObject(PSKey.To, PSClass.Layer, desc2);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Transform
  function step31(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    desc1.putEnumerated(PSKey.FreeTransformCenterState, PSType.QuadCenterState, PSEnum.QCSAverage);
    var desc2 = new ActionDescriptor();
    desc2.putUnitDouble(PSKey.Horizontal, PSUnit.Distance, -0.72);
    desc2.putUnitDouble(PSKey.Vertical, PSUnit.Distance, -0.72);
    desc1.putObject(PSKey.Offset, PSKey.Offset, desc2);
    desc1.putUnitDouble(PSKey.Width, PSUnit.Percent, 162.614468864469);
    desc1.putUnitDouble(PSKey.Height, PSUnit.Percent, 162.603021978022);
    desc1.putEnumerated(PSKey.Interpolation, PSType.Interpolation, PSEnum.Bicubic);
    executeAction(PSEvent.Transform, desc1, dialogMode);
  };

  // Set
  function step32(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    var desc2 = new ActionDescriptor();
    desc2.putUnitDouble(PSKey.Opacity, PSUnit.Percent, 40);
    desc1.putObject(PSKey.To, PSClass.Layer, desc2);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Hide
  function step33(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var list1 = new ActionList();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    list1.putReference(ref1);
    desc1.putList(PSString.Null, list1);
    executeAction(PSEvent.Hide, desc1, dialogMode);
  };

  // Select
  function step34(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putName(PSClass.Layer, "20 px");
    desc1.putReference(PSString.Null, ref1);
    desc1.putBoolean(PSKey.MakeVisible, false);
    executeAction(PSEvent.Select, desc1, dialogMode);
  };

  // Select
  function step35(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putName(PSClass.Layer, "5 px");
    desc1.putReference(PSString.Null, ref1);
    desc1.putEnumerated(PSString.selectionModifier, PSString.selectionModifierType, PSString.addToSelectionContinuous);
    desc1.putBoolean(PSKey.MakeVisible, false);
    executeAction(PSEvent.Select, desc1, dialogMode);
  };

  // Make
  function step36(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putClass(PSString.layerGroup);
    desc1.putReference(PSString.Null, ref1);
    var ref2 = new ActionReference();
    ref2.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSKey.From, ref2);
    var desc2 = new ActionDescriptor();
    desc2.putEnumerated(PSKey.Color, PSKey.Color, PSEnum.Blue);
    desc1.putObject(PSKey.Using, PSString.layerGroup, desc2);
    executeAction(PSEvent.Make, desc1, dialogMode);
  };

  // Set
  function step37(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    var desc2 = new ActionDescriptor();
    desc2.putString(PSKey.Name, "Noise");
    desc1.putObject(PSKey.To, PSClass.Layer, desc2);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Set
  function step38(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    var desc2 = new ActionDescriptor();
    desc2.putEnumerated(PSKey.Mode, PSType.BlendMode, PSEnum.Multiply);
    desc1.putObject(PSKey.To, PSClass.Layer, desc2);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Select
  function step39(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putName(PSClass.Layer, "Skin Pigment");
    desc1.putReference(PSString.Null, ref1);
    desc1.putBoolean(PSKey.MakeVisible, false);
    executeAction(PSEvent.Select, desc1, dialogMode);
  };

  // Make
  function step40(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putClass(PSClass.AdjustmentLayer);
    desc1.putReference(PSString.Null, ref1);
    var desc2 = new ActionDescriptor();
    var desc3 = new ActionDescriptor();
    desc3.putEnumerated(PSString.presetKind, PSString.presetKindType, PSString.presetKindDefault);
    desc3.putBoolean(PSKey.Colorize, false);
    desc2.putObject(PSKey.Type, PSClass.HueSaturation, desc3);
    desc1.putObject(PSKey.Using, PSClass.AdjustmentLayer, desc2);
    executeAction(PSEvent.Make, desc1, dialogMode);
  };

  // Create Clipping Mask
  function step41(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    executeAction(sTID('groupEvent'), desc1, dialogMode);
  };

  // Select
  function step42(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Channel, PSClass.Channel, PSEnum.RGB);
    desc1.putReference(PSString.Null, ref1);
    desc1.putBoolean(PSKey.MakeVisible, false);
    executeAction(PSEvent.Select, desc1, dialogMode);
  };

  // Set
  function step43(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    var desc2 = new ActionDescriptor();
    desc2.putString(PSKey.Name, "Edit");
    desc1.putObject(PSKey.To, PSClass.Layer, desc2);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Set
  function step44(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.AdjustmentLayer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    var desc2 = new ActionDescriptor();
    var list1 = new ActionList();
    var desc3 = new ActionDescriptor();
    desc3.putEnumerated(PSClass.Channel, PSClass.Channel, PSEnum.Composite);
    desc3.putInteger(PSKey.Hue, 30);
    desc3.putInteger(PSKey.Start, 80);
    desc3.putInteger(PSKey.Lightness, 85);
    list1.putObject(PSClass.HueSatAdjustmentV2, desc3);
    desc2.putList(PSKey.Adjustment, list1);
    desc1.putObject(PSKey.To, PSClass.HueSaturation, desc2);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Select
  function step45(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Channel, PSClass.Channel, PSClass.Mask);
    desc1.putReference(PSString.Null, ref1);
    desc1.putBoolean(PSKey.MakeVisible, false);
    executeAction(PSEvent.Select, desc1, dialogMode);
  };

  // Delete
  function step46(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Channel, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    executeAction(PSEvent.Delete, desc1, dialogMode);
  };

  // Set
  function step47(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.AdjustmentLayer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    var desc2 = new ActionDescriptor();
    desc2.putBoolean(PSKey.Colorize, true);
    var list1 = new ActionList();
    var desc3 = new ActionDescriptor();
    desc3.putEnumerated(PSClass.Channel, PSClass.Channel, PSEnum.Composite);
    desc3.putInteger(PSKey.Hue, 0);
    desc3.putInteger(PSKey.Start, 25);
    desc3.putInteger(PSKey.Lightness, 0);
    list1.putObject(PSClass.HueSatAdjustmentV2, desc3);
    desc2.putList(PSKey.Adjustment, list1);
    desc1.putObject(PSKey.To, PSClass.HueSaturation, desc2);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Set
  function step48(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.AdjustmentLayer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    var desc2 = new ActionDescriptor();
    var list1 = new ActionList();
    var desc3 = new ActionDescriptor();
    desc3.putEnumerated(PSClass.Channel, PSClass.Channel, PSEnum.Composite);
    desc3.putInteger(PSKey.Hue, 30);
    desc3.putInteger(PSKey.Start, 70);
    desc3.putInteger(PSKey.Lightness, 85);
    list1.putObject(PSClass.HueSatAdjustmentV2, desc3);
    desc2.putList(PSKey.Adjustment, list1);
    desc1.putObject(PSKey.To, PSClass.HueSaturation, desc2);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Select
  function step49(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putName(PSClass.Layer, "Noise");
    desc1.putReference(PSString.Null, ref1);
    desc1.putBoolean(PSKey.MakeVisible, false);
    executeAction(PSEvent.Select, desc1, dialogMode);
  };

  // Make
  function step50(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    desc1.putClass(PSKey.New, PSClass.Channel);
    var ref1 = new ActionReference();
    ref1.putEnumerated(PSClass.Channel, PSClass.Channel, PSClass.Mask);
    desc1.putReference(PSKey.At, ref1);
    desc1.putEnumerated(PSKey.Using, PSType.UserMaskOptions, PSEnum.HideAll);
    executeAction(PSEvent.Make, desc1, dialogMode);
  };

  // Select
  function step51(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putClass(PSClass.PaintbrushTool);
    desc1.putReference(PSString.Null, ref1);
    executeAction(PSEvent.Select, desc1, dialogMode);
  };

  step1();      // Make
  step2();      // Set
  step3();      // Select
  step4();      // Set
  step5();      // Make
  step6();      // Set
  step7();      // Set
  step8();      // Reset
  step9();      // Exchange
  step10();      // Fill
  step11();      // Add Noise
  step12();      // Transform
  step13();      // Set
  step14();      // Duplicate
  step15();      // Set
  step16();      // Set
  step17();      // Set
  step18();      // Set
  step19();      // Transform
  step20();      // Set
  step21();      // Duplicate
  step22();      // Set
  step23();      // Set
  step24();      // Set
  step25();      // Set
  step26();      // Transform
  step27();      // Set
  step28();      // Set
  step29();      // Layer Via Copy
  step30();      // Set
  step31();      // Transform
  step32();      // Set
  step33();      // Hide
  step34();      // Select
  step35();      // Select
  step36();      // Make
  step37();      // Set
  step38();      // Set
  step39();      // Select
  step40();      // Make
  step41();      // Create Clipping Mask
  step42();      // Select
  step43();      // Set
  step44();      // Set
  step45();      // Select
  step46();      // Delete
  step47();      // Set
  step48(true, true);      // Set
  step49();      // Select
  step50();      // Make
  step51();      // Select
};



cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };

//
// ReturnPigment.loadSymbols
//   Loading up the symbol definitions like this makes it possible
//   to include several of these generated files in one master file
//   provided a prefix is specified other than the default. It also
//   skips the definitions if PSConstants has already been loaded.
//
ReturnPigment.loadSymbols = function() {
  var dbgLevel = $.level;
  $.level = 0;
  try {
    PSConstants;
    return; // only if PSConstants is defined
  } catch (e) {
  } finally {
    $.level = dbgLevel;
  }
  var needDefs = true;
  $.level = 0;
  try {
    PSClass;
    needDefs = false;
  } catch (e) {
  } finally {
    $.level = dbgLevel;
  }
  if (needDefs) {
    PSClass = function() {};
    PSEnum = function() {};
    PSEvent = function() {};
    PSForm = function() {};
    PSKey = function() {};
    PSType = function() {};
    PSUnit = function() {};
    PSString = function() {};
  }

  // We may still end up duplicating some of the following definitions
  // but at least we don't redefine PSClass, etc... and wipe out others
  PSClass.AdjustmentLayer = cTID('AdjL');
  PSClass.Calculation = cTID('Clcl');
  PSClass.Channel = cTID('Chnl');
  PSClass.CloneStampTool = cTID('ClTl');
  PSClass.Curves = cTID('Crvs');
  PSClass.CurvesAdjustment = cTID('CrvA');
  PSClass.HueSatAdjustmentV2 = cTID('Hst2');
  PSClass.HueSaturation = cTID('HStr');
  PSClass.Layer = cTID('Lyr ');
  PSClass.Mask = cTID('Msk ');
  PSClass.PaintbrushTool = cTID('PbTl');
  PSClass.Point = cTID('Pnt ');
  PSClass.Version = cTID('Vrsn');
  PSEnum.All = cTID('Al  ');
  PSEnum.Bicubic = cTID('Bcbc');
  PSEnum.Blue = cTID('Bl  ');
  PSEnum.Composite = cTID('Cmps');
  PSEnum.ForegroundColor = cTID('FrgC');
  PSEnum.GaussianDistribution = cTID('Gsn ');
  PSEnum.HideAll = cTID('HdAl');
  PSEnum.Merged = cTID('Mrgd');
  PSEnum.Multiply = cTID('Mltp');
  PSEnum.None = cTID('None');
  PSEnum.Normal = cTID('Nrml');
  PSEnum.Overlay = cTID('Ovrl');
  PSEnum.QCSAverage = cTID('Qcsa');
  PSEnum.RGB = cTID('RGB ');
  PSEnum.Subtract = cTID('Sbtr');
  PSEnum.Target = cTID('Trgt');
  PSEvent.Delete = cTID('Dlt ');
  PSEvent.Desaturate = cTID('Dstt');
  PSEvent.Duplicate = cTID('Dplc');
  PSEvent.Exchange = cTID('Exch');
  PSEvent.Fill = cTID('Fl  ');
  PSEvent.Hide = cTID('Hd  ');
  PSEvent.Invert = cTID('Invr');
  PSEvent.Make = cTID('Mk  ');
  PSEvent.Move = cTID('move');
  PSEvent.Reset = cTID('Rset');
  PSEvent.Select = cTID('slct');
  PSEvent.Set = cTID('setd');
  PSEvent.Show = cTID('Shw ');
  PSEvent.Transform = cTID('Trnf');
  PSKey.Adjustment = cTID('Adjs');
  PSKey.At = cTID('At  ');
  PSKey.Brightness = cTID('Brgh');
  PSKey.Color = cTID('Clr ');
  PSKey.Colorize = cTID('Clrz');
  PSKey.Colors = cTID('Clrs');
  PSKey.Contrast = cTID('Cntr');
  PSKey.Curve = cTID('Crv ');
  PSKey.Distribution = cTID('Dstr');
  PSKey.FilterLayerRandomSeed = cTID('FlRs');
  PSKey.FreeTransformCenterState = cTID('FTcs');
  PSKey.From = cTID('From');
  PSKey.Height = cTID('Hght');
  PSKey.Horizontal = cTID('Hrzn');
  PSKey.Hue = cTID('H   ');
  PSKey.Interpolation = cTID('Intr');
  PSKey.Lightness = cTID('Lght');
  PSKey.MakeVisible = cTID('MkVs');
  PSKey.Mode = cTID('Md  ');
  PSKey.Monochromatic = cTID('Mnch');
  PSKey.Name = cTID('Nm  ');
  PSKey.New = cTID('Nw  ');
  PSKey.Noise = cTID('Nose');
  PSKey.Offset = cTID('Ofst');
  PSKey.Opacity = cTID('Opct');
  PSKey.Radius = cTID('Rds ');
  PSKey.Scale = cTID('Scl ');
  PSKey.Start = cTID('Strt');
  PSKey.Threshold = cTID('Thsh');
  PSKey.To = cTID('T   ');
  PSKey.ToggleOthers = cTID('TglO');
  PSKey.Type = cTID('Type');
  PSKey.Using = cTID('Usng');
  PSKey.Vertical = cTID('Vrtc');
  PSKey.Width = cTID('Wdth');
  PSKey.With = cTID('With');
  PSString.Null = sTID('null');
  PSString.addToSelectionContinuous = sTID('addToSelectionContinuous');
  PSString.layerGroup = sTID('layerSection');
  PSString.linearLight = sTID('linearLight');
  PSString.presetKind = sTID('presetKind');
  PSString.presetKindCustom = sTID('presetKindCustom');
  PSString.presetKindDefault = sTID('presetKindDefault');
  PSString.presetKindType = sTID('presetKindType');
  PSString.selection = sTID('selection');
  PSString.selectionModifier = sTID('selectionModifier');
  PSString.selectionModifierType = sTID('selectionModifierType');
  PSType.BlendMode = cTID('BlnM');
  PSType.Calculation = cTID('Clcn');
  PSType.FillContents = cTID('FlCn');
  PSType.Interpolation = cTID('Intp');
  PSType.Ordinal = cTID('Ordn');
  PSType.QuadCenterState = cTID('QCSt');
  PSType.UserMaskOptions = cTID('UsrM');
  PSUnit.Distance = cTID('#Rlt');
  PSUnit.Percent = cTID('#Prc');
  PSUnit.Pixels = cTID('#Pxl');
};

ReturnPigment.loadSymbols(); // load up our symbols



//=========================================
//                    ReturnPigment.main
//=========================================
//

ReturnPigment.main = function () {
  ReturnPigment();
};

ReturnPigment.main();

// EOF
