//
// Generated Tue Feb 17 2015 14:49:12 GMT+0600
//

//
//==================== Volume HRLA ==============
//
function VolumeHRLA() {
  // 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(PSClass.Layer);
    desc1.putReference(PSString.Null, ref1);
    executeAction(PSEvent.Make, desc1, dialogMode);
  };

  // Merge Visible
  function step2(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    desc1.putBoolean(PSKey.Duplicate, true);
    executeAction(sTID('mergeVisible'), desc1, dialogMode);
  };

  // Unsharp Mask
  function step3(enabled, withDialog) {
    if (enabled != undefined && !enabled)
      return;
    var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
    var desc1 = new ActionDescriptor();
    desc1.putUnitDouble(PSKey.Amount, PSUnit.Percent, 35);
    desc1.putUnitDouble(PSKey.Radius, PSUnit.Pixels, 85);
    desc1.putInteger(PSKey.Threshold, 0);
    executeAction(sTID('unsharpMask'), 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.putUnitDouble(PSKey.Opacity, PSUnit.Percent, 100);
    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();
    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 step6(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);
  };

  // Select
  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.Channel, PSClass.Channel, PSEnum.RGB);
    desc1.putReference(PSString.Null, ref1);
    desc1.putBoolean(PSKey.MakeVisible, false);
    executeAction(PSEvent.Select, desc1, dialogMode);
  };

  // Set
  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.putEnumerated(PSClass.Layer, PSType.Ordinal, PSEnum.Target);
    desc1.putReference(PSString.Null, ref1);
    var desc2 = new ActionDescriptor();
    desc2.putString(PSKey.Name, "Volume HRLA");
    desc1.putObject(PSKey.To, PSClass.Layer, desc2);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  // Select
  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.putClass(PSClass.PaintbrushTool);
    desc1.putReference(PSString.Null, ref1);
    executeAction(PSEvent.Select, desc1, dialogMode);
  };

  // Select
  function step10(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);
  };

  // Set
  function step11(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);
  };

  // Set
  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);
    var desc2 = new ActionDescriptor();
    desc2.putEnumerated(PSKey.Mode, PSType.BlendMode, PSEnum.Luminosity);
    desc1.putObject(PSKey.To, PSClass.Layer, desc2);
    executeAction(PSEvent.Set, desc1, dialogMode);
  };

  step1();      // Make
  step2();      // Merge Visible
  step3();      // Unsharp Mask
  step4();      // Set
  step5();      // Make
  step6();      // Select
  step7();      // Select
  step8();      // Set
  step9();      // Select
  step10();      // Select
  step11();      // Set
  step12();      // Set
};



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

//
// VolumeHRLA.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.
//
VolumeHRLA.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.Channel = cTID('Chnl');
  PSClass.ChannelMatrix = cTID('ChMx');
  PSClass.ChannelMixer = cTID('ChnM');
  PSClass.Curves = cTID('Crvs');
  PSClass.CurvesAdjustment = cTID('CrvA');
  PSClass.Layer = cTID('Lyr ');
  PSClass.Mask = cTID('Msk ');
  PSClass.PaintbrushTool = cTID('PbTl');
  PSClass.Point = cTID('Pnt ');
  PSEnum.Best = cTID('Bst ');
  PSEnum.Blue = cTID('Bl  ');
  PSEnum.Composite = cTID('Cmps');
  PSEnum.HideAll = cTID('HdAl');
  PSEnum.Luminosity = cTID('Lmns');
  PSEnum.Midtones = cTID('Mdtn');
  PSEnum.None = cTID('None');
  PSEnum.RGB = cTID('RGB ');
  PSEnum.Target = cTID('Trgt');
  PSEnum.Zoom = cTID('Zm  ');
  PSEvent.Delete = cTID('Dlt ');
  PSEvent.Hide = cTID('Hd  ');
  PSEvent.Make = cTID('Mk  ');
  PSEvent.Select = cTID('slct');
  PSEvent.Set = cTID('setd');
  PSEvent.Show = cTID('Shw ');
  PSKey.Adjustment = cTID('Adjs');
  PSKey.Amount = cTID('Amnt');
  PSKey.At = cTID('At  ');
  PSKey.BlurMethod = cTID('BlrM');
  PSKey.BlurQuality = cTID('BlrQ');
  PSKey.Color = cTID('Clr ');
  PSKey.Colors = cTID('Clrs');
  PSKey.Constrain = cTID('Cnst');
  PSKey.Curve = cTID('Crv ');
  PSKey.Duplicate = cTID('Dplc');
  PSKey.From = cTID('From');
  PSKey.Gray = cTID('Gry ');
  PSKey.Green = cTID('Grn ');
  PSKey.Horizontal = cTID('Hrzn');
  PSKey.MakeVisible = cTID('MkVs');
  PSKey.Mode = cTID('Md  ');
  PSKey.Monochromatic = cTID('Mnch');
  PSKey.Name = cTID('Nm  ');
  PSKey.New = cTID('Nw  ');
  PSKey.Opacity = cTID('Opct');
  PSKey.Radius = cTID('Rds ');
  PSKey.Red = cTID('Rd  ');
  PSKey.Threshold = cTID('Thsh');
  PSKey.To = cTID('T   ');
  PSKey.Type = cTID('Type');
  PSKey.Using = cTID('Usng');
  PSKey.Vertical = cTID('Vrtc');
  PSString.Null = sTID('null');
  PSString.addToSelectionContinuous = sTID('addToSelectionContinuous');
  PSString.layerGroup = sTID('layerSection');
  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.Ordinal = cTID('Ordn');
  PSType.UserMaskOptions = cTID('UsrM');
  PSUnit.Percent = cTID('#Prc');
  PSUnit.Pixels = cTID('#Pxl');
};

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



//=========================================
//                    VolumeHRLA.main
//=========================================
//

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

VolumeHRLA.main();

// EOF
