$._ext_BTNZRG={
    run : function() {    

if (app.documents.length !== 0)

    app.activeDocument.suspendHistory("PS黑作坊_自然光", "zrg()");

function zrg() {

// ===================================================
var idslct = charIDToTypeID( "slct" );
    var desc3 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref2 = new ActionReference();
        var idChnl = charIDToTypeID( "Chnl" );
        var idChnl = charIDToTypeID( "Chnl" );
        var idRGB = charIDToTypeID( "RGB " );
        ref2.putEnumerated( idChnl, idChnl, idRGB );
    desc3.putReference( idnull, ref2 );
executeAction( idslct, desc3, DialogModes.NO );

// ===================================================
app.activeDocument.selection.deselect()

// ===================================================
var idMk = charIDToTypeID( "Mk  " );
    var desc5 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref3 = new ActionReference();
        var idAdjL = charIDToTypeID( "AdjL" );
        ref3.putClass( idAdjL );
    desc5.putReference( idnull, ref3 );
    var idUsng = charIDToTypeID( "Usng" );
        var desc6 = new ActionDescriptor();
        var idNm = charIDToTypeID( "Nm  " );
        desc6.putString( idNm, """TK selection creation""" );
        var idType = charIDToTypeID( "Type" );
            var desc7 = new ActionDescriptor();
            var idpresetKind = stringIDToTypeID( "presetKind" );
            var idpresetKindType = stringIDToTypeID( "presetKindType" );
            var idpresetKindDefault = stringIDToTypeID( "presetKindDefault" );
            desc7.putEnumerated( idpresetKind, idpresetKindType, idpresetKindDefault );
        var idLvls = charIDToTypeID( "Lvls" );
        desc6.putObject( idType, idLvls, desc7 );
    var idAdjL = charIDToTypeID( "AdjL" );
    desc5.putObject( idUsng, idAdjL, desc6 );
executeAction( idMk, desc5, DialogModes.NO );

// ===================================================
var idMk = charIDToTypeID( "Mk  " );
    var desc5 = new ActionDescriptor();
    var idNw = charIDToTypeID( "Nw  " );
    var idChnl = charIDToTypeID( "Chnl" );
    desc5.putClass( idNw, idChnl );
    var idUsng = charIDToTypeID( "Usng" );
        var desc6 = new ActionDescriptor();
        var idT = charIDToTypeID( "T   " );
            var ref4 = new ActionReference();
            var idChnl = charIDToTypeID( "Chnl" );
            var idChnl = charIDToTypeID( "Chnl" );
            var idGry = charIDToTypeID( "Gry " );
            ref4.putEnumerated( idChnl, idChnl, idGry );
            var idLyr = charIDToTypeID( "Lyr " );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idMrgd = charIDToTypeID( "Mrgd" );
            ref4.putEnumerated( idLyr, idOrdn, idMrgd );
        desc6.putReference( idT, ref4 );
        var idClcl = charIDToTypeID( "Clcl" );
        var idClcn = charIDToTypeID( "Clcn" );
        var idMltp = charIDToTypeID( "Mltp" );
        desc6.putEnumerated( idClcl, idClcn, idMltp );
        var idSrctwo = charIDToTypeID( "Src2" );
            var ref5 = new ActionReference();
            var idChnl = charIDToTypeID( "Chnl" );
            var idChnl = charIDToTypeID( "Chnl" );
            var idGry = charIDToTypeID( "Gry " );
            ref5.putEnumerated( idChnl, idChnl, idGry );
            var idLyr = charIDToTypeID( "Lyr " );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idMrgd = charIDToTypeID( "Mrgd" );
            ref5.putEnumerated( idLyr, idOrdn, idMrgd );
        desc6.putReference( idSrctwo, ref5 );
    var idClcl = charIDToTypeID( "Clcl" );
    desc5.putObject( idUsng, idClcl, desc6 );
executeAction( idMk, desc5, DialogModes.NO );

// ===================================================
var idsetd = charIDToTypeID( "setd" );
    var desc7 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref6 = new ActionReference();
        var idChnl = charIDToTypeID( "Chnl" );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idTrgt = charIDToTypeID( "Trgt" );
        ref6.putEnumerated( idChnl, idOrdn, idTrgt );
    desc7.putReference( idnull, ref6 );
    var idT = charIDToTypeID( "T   " );
        var desc8 = new ActionDescriptor();
        var idNm = charIDToTypeID( "Nm  " );
        desc8.putString( idNm, """Lights-2 temp""" );
    var idChnl = charIDToTypeID( "Chnl" );
    desc7.putObject( idT, idChnl, desc8 );
executeAction( idsetd, desc7, DialogModes.NO );

// ===================================================
var idDlt = charIDToTypeID( "Dlt " );
    var desc12 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref10 = new ActionReference();
        var idLyr = charIDToTypeID( "Lyr " );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idTrgt = charIDToTypeID( "Trgt" );
        ref10.putEnumerated( idLyr, idOrdn, idTrgt );
    desc12.putReference( idnull, ref10 );	
executeAction( idDlt, desc12, DialogModes.NO ); 

// ===================================================
var idslct = charIDToTypeID( "slct" );
    var desc9 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref7 = new ActionReference();
        var idChnl = charIDToTypeID( "Chnl" );
        var idChnl = charIDToTypeID( "Chnl" );
        var idRGB = charIDToTypeID( "RGB " );
        ref7.putEnumerated( idChnl, idChnl, idRGB );
    desc9.putReference( idnull, ref7 );
executeAction( idslct, desc9, DialogModes.NO );


// ===================================================
var idMk = charIDToTypeID( "Mk  " );
    var desc13 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref9 = new ActionReference();
        var idAdjL = charIDToTypeID( "AdjL" );
        ref9.putClass( idAdjL );
    desc13.putReference( idnull, ref9 );
    var idUsng = charIDToTypeID( "Usng" );
        var desc14 = new ActionDescriptor();
        var idNm = charIDToTypeID( "Nm  " );
        desc14.putString( idNm, """PS黑作坊_光亮""" );
        var idMd = charIDToTypeID( "Md  " );
        var idBlnM = charIDToTypeID( "BlnM" );
        var idScrn = charIDToTypeID( "Scrn" );
        desc14.putEnumerated( idMd, idBlnM, idScrn );
        var idType = charIDToTypeID( "Type" );
            var desc15 = new ActionDescriptor();
            var idpresetKind = stringIDToTypeID( "presetKind" );
            var idpresetKindType = stringIDToTypeID( "presetKindType" );
            var idpresetKindDefault = stringIDToTypeID( "presetKindDefault" );
            desc15.putEnumerated( idpresetKind, idpresetKindType, idpresetKindDefault );
        var idCrvs = charIDToTypeID( "Crvs" );
        desc14.putObject( idType, idCrvs, desc15 );
    var idAdjL = charIDToTypeID( "AdjL" );
    desc13.putObject( idUsng, idAdjL, desc14 );
executeAction( idMk, desc13, DialogModes.NO );

// ===================================================
var idmove = charIDToTypeID( "move" );
    var desc16 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref10 = new ActionReference();
        var idLyr = charIDToTypeID( "Lyr " );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idTrgt = charIDToTypeID( "Trgt" );
        ref10.putEnumerated( idLyr, idOrdn, idTrgt );
    desc16.putReference( idnull, ref10 );
    var idT = charIDToTypeID( "T   " );
        var ref11 = new ActionReference();
        var idLyr = charIDToTypeID( "Lyr " );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idFrnt = charIDToTypeID( "Frnt" );
        ref11.putEnumerated( idLyr, idOrdn, idFrnt );
    desc16.putReference( idT, ref11 );
executeAction( idmove, desc16, DialogModes.NO );

// ===================================================
var idmove = charIDToTypeID( "move" );
    var desc17 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref12 = new ActionReference();
        var idLyr = charIDToTypeID( "Lyr " );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idTrgt = charIDToTypeID( "Trgt" );
        ref12.putEnumerated( idLyr, idOrdn, idTrgt );
    desc17.putReference( idnull, ref12 );
    var idT = charIDToTypeID( "T   " );
        var ref13 = new ActionReference();
        var idLyr = charIDToTypeID( "Lyr " );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idFrnt = charIDToTypeID( "Frnt" );
        ref13.putEnumerated( idLyr, idOrdn, idFrnt );
    desc17.putReference( idT, ref13 );
executeAction( idmove, desc17, DialogModes.NO );

// ===================================================
var idMk = charIDToTypeID( "Mk  " );
    var desc18 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref14 = new ActionReference();
        var idLyr = charIDToTypeID( "Lyr " );
        ref14.putClass( idLyr );
    desc18.putReference( idnull, ref14 );
    var idUsng = charIDToTypeID( "Usng" );
        var desc19 = new ActionDescriptor();
        var idNm = charIDToTypeID( "Nm  " );
        desc19.putString( idNm, """PS黑作坊_余晖""" );
    var idLyr = charIDToTypeID( "Lyr " );
    desc18.putObject( idUsng, idLyr, desc19 );
executeAction( idMk, desc18, DialogModes.NO );

// ===================================================
var idMrgV = charIDToTypeID( "MrgV" );
    var desc20 = new ActionDescriptor();
    var idDplc = charIDToTypeID( "Dplc" );
    desc20.putBoolean( idDplc, true );
executeAction( idMrgV, desc20, DialogModes.NO );

// ===================================================
var idnewPlacedLayer = stringIDToTypeID( "newPlacedLayer" );
executeAction( idnewPlacedLayer, undefined, DialogModes.NO );

// ===================================================
var idsetd = charIDToTypeID( "setd" );
    var desc21 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref15 = new ActionReference();
        var idLyr = charIDToTypeID( "Lyr " );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idTrgt = charIDToTypeID( "Trgt" );
        ref15.putEnumerated( idLyr, idOrdn, idTrgt );
    desc21.putReference( idnull, ref15 );
    var idT = charIDToTypeID( "T   " );
        var desc22 = new ActionDescriptor();
        var idMd = charIDToTypeID( "Md  " );
        var idBlnM = charIDToTypeID( "BlnM" );
        var idMltp = charIDToTypeID( "Mltp" );
        desc22.putEnumerated( idMd, idBlnM, idMltp );
    var idLyr = charIDToTypeID( "Lyr " );
    desc21.putObject( idT, idLyr, desc22 );
executeAction( idsetd, desc21, DialogModes.NO );

// ===================================================
var idslct = charIDToTypeID( "slct" );
    var desc23 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref16 = new ActionReference();
        var idLyr = charIDToTypeID( "Lyr " );
        ref16.putName( idLyr, "PS黑作坊_光亮" );
    desc23.putReference( idnull, ref16 );
    var idselectionModifier = stringIDToTypeID( "selectionModifier" );
    var idselectionModifierType = stringIDToTypeID( "selectionModifierType" );
    var idaddToSelection = stringIDToTypeID( "addToSelection" );
    desc23.putEnumerated( idselectionModifier, idselectionModifierType, idaddToSelection );
    var idMkVs = charIDToTypeID( "MkVs" );
    desc23.putBoolean( idMkVs, false );
executeAction( idslct, desc23, DialogModes.NO );

// ===================================================
var idMk = charIDToTypeID( "Mk  " );
    var desc24 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref17 = new ActionReference();
        var idlayerSection = stringIDToTypeID( "layerSection" );
        ref17.putClass( idlayerSection );
    desc24.putReference( idnull, ref17 );
    var idFrom = charIDToTypeID( "From" );
        var ref18 = new ActionReference();
        var idLyr = charIDToTypeID( "Lyr " );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idTrgt = charIDToTypeID( "Trgt" );
        ref18.putEnumerated( idLyr, idOrdn, idTrgt );
    desc24.putReference( idFrom, ref18 );
    var idUsng = charIDToTypeID( "Usng" );
        var desc25 = new ActionDescriptor();
        var idNm = charIDToTypeID( "Nm  " );
        desc25.putString( idNm, """PS黑作坊_自然光""" );
    var idlayerSection = stringIDToTypeID( "layerSection" );
    desc24.putObject( idUsng, idlayerSection, desc25 );
executeAction( idMk, desc24, DialogModes.NO );

// ===================================================
var idMk = charIDToTypeID( "Mk  " );
    var desc26 = new ActionDescriptor();
    var idNw = charIDToTypeID( "Nw  " );
    var idChnl = charIDToTypeID( "Chnl" );
    desc26.putClass( idNw, idChnl );
    var idAt = charIDToTypeID( "At  " );
        var ref19 = new ActionReference();
        var idChnl = charIDToTypeID( "Chnl" );
        var idChnl = charIDToTypeID( "Chnl" );
        var idMsk = charIDToTypeID( "Msk " );
        ref19.putEnumerated( idChnl, idChnl, idMsk );
    desc26.putReference( idAt, ref19 );
    var idUsng = charIDToTypeID( "Usng" );
    var idUsrM = charIDToTypeID( "UsrM" );
    var idRvlA = charIDToTypeID( "RvlA" );
    desc26.putEnumerated( idUsng, idUsrM, idRvlA );
executeAction( idMk, desc26, DialogModes.NO );

// ===================================================
var idAppI = charIDToTypeID( "AppI" );
    var desc27 = new ActionDescriptor();
    var idWith = charIDToTypeID( "With" );
        var desc28 = new ActionDescriptor();
        var idT = charIDToTypeID( "T   " );
            var ref20 = new ActionReference();
            var idChnl = charIDToTypeID( "Chnl" );
            ref20.putName( idChnl, "Lights-2 temp" );
        desc28.putReference( idT, ref20 );
        var idPrsT = charIDToTypeID( "PrsT" );
        desc28.putBoolean( idPrsT, true );
    var idClcl = charIDToTypeID( "Clcl" );
    desc27.putObject( idWith, idClcl, desc28 );
executeAction( idAppI, desc27, DialogModes.NO );

// ===================================================
var idDlt = charIDToTypeID( "Dlt " );
    var desc29 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref21 = new ActionReference();
        var idChnl = charIDToTypeID( "Chnl" );
        ref21.putName( idChnl, "Lights-2 temp" );
    desc29.putReference( idnull, ref21 );
executeAction( idDlt, desc29, DialogModes.NO );

// ===================================================
var idslct = charIDToTypeID( "slct" );
    var desc30 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref22 = new ActionReference();
        var idLyr = charIDToTypeID( "Lyr " );
        ref22.putName( idLyr, "PS黑作坊_余晖" );
    desc30.putReference( idnull, ref22 );
    var idMkVs = charIDToTypeID( "MkVs" );
    desc30.putBoolean( idMkVs, false );
executeAction( idslct, desc30, DialogModes.NO );

// ===================================================
var idGsnB = charIDToTypeID( "GsnB" );
    var desc31 = new ActionDescriptor();
    var idRds = charIDToTypeID( "Rds " );
    var idPxl = charIDToTypeID( "#Pxl" );
    desc31.putUnitDouble( idRds, idPxl, 20.000000 );
    try {  //to execute High Pass Filler
executeAction( idGsnB, desc31, DialogModes.ALL );    }
catch(e){  //delete layer if Cancel chosen in High Pass Filter dialog
var idDlt = charIDToTypeID( "Dlt " );
    var desc5 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref4 = new ActionReference();
        var idLyr = charIDToTypeID( "Lyr " );
        ref4.putName( idLyr, "PS黑作坊_自然光" );
    desc5.putReference( idnull, ref4 );
executeAction( idDlt, desc5, DialogModes.NO );  }  //end catch(e)          
    


}  //end tkaction() function
						app.bringToFront();
    },
};

    							