if (ScriptUI.environment.keyboardState.shiftKey) {
    win = new Window("dialog", "快速修饰 + 自动蒙板");
    win.orientation = "column";
    b1L = 47;
    b2L = 218;

    function AutoMask() {
        var idDlt = charIDToTypeID("Dlt ");
        var desc63 = new ActionDescriptor();
        var idnull = charIDToTypeID("null");
        var ref28 = new ActionReference();
        var idChnl = charIDToTypeID("Chnl");
        var idOrdn = charIDToTypeID("Ordn");
        var idTrgt = charIDToTypeID("Trgt");
        ref28.putEnumerated(idChnl, idOrdn, idTrgt);
        desc63.putReference(idnull, ref28);
        executeAction(idDlt, desc63, DialogModes.NO);
        var idClrR = charIDToTypeID("ClrR");
        var desc66 = new ActionDescriptor();
        var idFzns = charIDToTypeID("Fzns");
        desc66.putInteger(idFzns, 55);
        var idClrs = charIDToTypeID("Clrs");
        var idClrs = charIDToTypeID("Clrs");
        var idskinTone = stringIDToTypeID("skinTone");
        desc66.putEnumerated(idClrs, idClrs, idskinTone);
        var idcolorModel = stringIDToTypeID("colorModel");
        desc66.putInteger(idcolorModel, 0);
        executeAction(idClrR, desc66, DialogModes.NO);
        var idMk = charIDToTypeID("Mk  ");
        var desc67 = new ActionDescriptor();
        var idNw = charIDToTypeID("Nw  ");
        var idChnl = charIDToTypeID("Chnl");
        desc67.putClass(idNw, idChnl);
        var idAt = charIDToTypeID("At  ");
        var ref29 = new ActionReference();
        var idChnl = charIDToTypeID("Chnl");
        var idChnl = charIDToTypeID("Chnl");
        var idMsk = charIDToTypeID("Msk ");
        ref29.putEnumerated(idChnl, idChnl, idMsk);
        desc67.putReference(idAt, ref29);
        var idUsng = charIDToTypeID("Usng");
        var idUsrM = charIDToTypeID("UsrM");
        var idRvlS = charIDToTypeID("RvlS");
        desc67.putEnumerated(idUsng, idUsrM, idRvlS);
        executeAction(idMk, desc67, DialogModes.NO);
        var idRset = charIDToTypeID("Rset");
        var desc64 = new ActionDescriptor();
        var idnull = charIDToTypeID("null");
        var ref38 = new ActionReference();
        var idClr = charIDToTypeID("Clr ");
        var idClrs = charIDToTypeID("Clrs");
        ref38.putProperty(idClr, idClrs);
        desc64.putReference(idnull, ref38);
        executeAction(idRset, desc64, DialogModes.NO);
        var idExch = charIDToTypeID("Exch");
        var desc65 = new ActionDescriptor();
        var idnull = charIDToTypeID("null");
        var ref39 = new ActionReference();
        var idClr = charIDToTypeID("Clr ");
        var idClrs = charIDToTypeID("Clrs");
        ref39.putProperty(idClr, idClrs);
        desc65.putReference(idnull, ref39);
        executeAction(idExch, desc65, DialogModes.NO);
        app.refresh();
        var thisFile = new File($.fileName);
        var idOpn = charIDToTypeID("Opn ");
        var desc34 = new ActionDescriptor();
        var idnull = charIDToTypeID("null");
        desc34.putPath(idnull, new File(thisFile.path + "/FR4RM.jsx"));
        executeAction(idOpn, desc34, DialogModes.NO);
    }

    function Method4() {
        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);
            desc1.putInteger(PSKey.LayerID, 86);
            executeAction(PSEvent.Make, desc1, dialogMode);
        }

        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.putString(PSKey.Name, "Temp 1");
            desc1.putObject(PSKey.To, PSClass.Layer, desc2);
            executeAction(PSEvent.Set, desc1, dialogMode);
        }

        function step3(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);
        }

        function step4(enabled, withDialog) {
            if (enabled != undefined && !enabled) {
                return;
            }
            var dialogMode = withDialog ? DialogModes.ALL : DialogModes.NO;
            executeAction(sTID("copyToLayer"), undefined, dialogMode);
        }

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

        function step6(enabled, withDialog) {
            if (enabled != undefined && !enabled) {
                return;
            }
            var dialogMode = withDialog ? DialogModes.ALL : DialogModes.NO;
            executeAction(sTID("copyToLayer"), undefined, dialogMode);
        }

        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.putString(PSKey.Name, "Temp 3");
            desc1.putObject(PSKey.To, PSClass.Layer, desc2);
            executeAction(PSEvent.Set, desc1, dialogMode);
        }

        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.putName(PSClass.Layer, "Temp 1");
            desc1.putReference(PSString.Null, ref1);
            desc1.putBoolean(PSKey.MakeVisible, false);
            var list1 = new ActionList();
            list1.putInteger(87);
            desc1.putList(PSKey.LayerID, list1);
            executeAction(PSEvent.Select, desc1, dialogMode);
        }

        function step9(enabled, withDialog) {
            if (enabled != undefined && !enabled) {
                return;
            }
            var dialogMode = withDialog ? DialogModes.ALL : DialogModes.NO;
            var desc1 = new ActionDescriptor();
            desc1.putUnitDouble(PSKey.Radius, PSUnit.Pixels, FSR);
            executeAction(sTID("gaussianBlur"), desc1, dialogMode);
        }

        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.putName(PSClass.Layer, "Temp 2");
            desc1.putReference(PSString.Null, ref1);
            desc1.putBoolean(PSKey.MakeVisible, false);
            var list1 = new ActionList();
            list1.putInteger(88);
            desc1.putList(PSKey.LayerID, list1);
            executeAction(PSEvent.Select, desc1, dialogMode);
        }

        function step11(enabled, withDialog) {
            if (enabled != undefined && !enabled) {
                return;
            }
            var dialogMode = withDialog ? DialogModes.ALL : DialogModes.NO;
            var desc1 = new ActionDescriptor();
            desc1.putInteger(PSKey.Radius, DSR);
            desc1.putInteger(PSKey.Threshold, 0);
            executeAction(sTID("dustAndScratches"), desc1, dialogMode);
        }

        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.putName(PSClass.Layer, "Temp 3");
            desc1.putReference(PSString.Null, ref1);
            desc1.putBoolean(PSKey.MakeVisible, false);
            var list1 = new ActionList();
            list1.putInteger(89);
            desc1.putList(PSKey.LayerID, list1);
            executeAction(PSEvent.Select, desc1, dialogMode);
        }

        function step13(enabled, withDialog) {
            if (enabled != undefined && !enabled) {
                return;
            }
            var dialogMode = withDialog ? DialogModes.ALL : DialogModes.NO;
            var desc1 = new ActionDescriptor();
            desc1.putUnitDouble(PSKey.Radius, PSUnit.Pixels, FSR);
            executeAction(sTID("highPass"), desc1, dialogMode);
        }

        function step14(enabled, withDialog) {
            if (enabled != undefined && !enabled) {
                return;
            }
            var dialogMode = withDialog ? DialogModes.ALL : DialogModes.NO;
            var desc1 = new ActionDescriptor();
            desc1.putInteger(PSKey.Brightness, 0);
            desc1.putInteger(PSKey.Contrast, -50);
            executeAction(sTID("brightnessEvent"), desc1, dialogMode);
        }

        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.putEnumerated(PSKey.Mode, PSType.BlendMode, PSString.linearLight);
            desc1.putObject(PSKey.To, PSClass.Layer, desc2);
            executeAction(PSEvent.Set, desc1, dialogMode);
        }

        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.putName(PSClass.Layer, "Temp 1");
            desc1.putReference(PSString.Null, ref1);
            desc1.putEnumerated(PSString.selectionModifier, PSString.selectionModifierType, PSString.addToSelectionContinuous);
            desc1.putBoolean(PSKey.MakeVisible, false);
            var list1 = new ActionList();
            list1.putInteger(87);
            list1.putInteger(sTID("skinTone"), 90);
            list1.putInteger(sTID("contentAware"), 89);
            desc1.putList(PSKey.LayerID, list1);
            executeAction(PSEvent.Select, desc1, dialogMode);
        }

        function step17(enabled, withDialog) {
            if (enabled != undefined && !enabled) {
                return;
            }
            var dialogMode = withDialog ? DialogModes.ALL : DialogModes.NO;
            var desc1 = new ActionDescriptor();
            executeAction(sTID("mergeLayersNew"), desc1, dialogMode);
        }

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

        function step19(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);
        }

        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.putClass(PSClass.PaintbrushTool);
            desc1.putReference(PSString.Null, ref1);
            executeAction(PSEvent.Select, desc1, dialogMode);
        }
        step1();
        step2();
        step3();
        step4();
        step5();
        step6();
        step7();
        step8();
        step9();
        step10();
        step11();
        step12();
        step13();
        step14();
        step15();
        step16();
        step17();
        step18();
        step19();
        step20();
    }
    cTID = function(s) {
        return app.charIDToTypeID(s);
    };
    sTID = function(s) {
        return app.stringIDToTypeID(s);
    };
    Method4.loadSymbols = function() {
        var dbgLevel = $.level;
        $.level = 0;
        try {
            PSConstants;
            return;
        } 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() {

            };
        }
        PSClass.Channel = cTID("Chnl");
        PSClass.Layer = cTID("Lyr ");
        PSClass.Mask = cTID("Msk ");
        PSClass.PaintbrushTool = cTID("PbTl");
        PSEnum.HideAll = cTID("HdAl");
        PSEnum.Target = cTID("Trgt");
        PSEvent.Make = cTID("Mk  ");
        PSEvent.Select = cTID("slct");
        PSEvent.Set = cTID("setd");
        PSKey.At = cTID("At  ");
        PSKey.Brightness = cTID("Brgh");
        PSKey.Contrast = cTID("Cntr");
        PSKey.Duplicate = cTID("Dplc");
        PSKey.LayerID = cTID("LyrI");
        PSKey.MakeVisible = cTID("MkVs");
        PSKey.Mode = cTID("Md  ");
        PSKey.Name = cTID("Nm  ");
        PSKey.New = cTID("Nw  ");
        PSKey.Radius = cTID("Rds ");
        PSKey.Threshold = cTID("Thsh");
        PSKey.To = cTID("T   ");
        PSKey.Using = cTID("Usng");
        PSString.Null = sTID("null");
        PSString.addToSelectionContinuous = sTID("addToSelectionContinuous");
        PSString.linearLight = sTID("linearLight");
        PSString.selectionModifier = sTID("selectionModifier");
        PSString.selectionModifierType = sTID("selectionModifierType");
        PSType.BlendMode = cTID("BlnM");
        PSType.Ordinal = cTID("Ordn");
        PSType.UserMaskOptions = cTID("UsrM");
        PSUnit.Pixels = cTID("#Pxl");
    };
    Method4.loadSymbols();
    Method4.main = function() {
        Method4();
        AutoMask();
    };
    docRef = app.activeDocument;
    var dW = docRef.width.as("px");
    var dH = docRef.height.as("px");
    var S = (dW * dH) / 1000;
    if (app) {
        try {
            MainCatch322();
        } catch (e) {
            alert("light");
        }
    }

    function MainCatch322() {
        if (S > 0) {
            getS = "     使用 3 px line";
        }
        if (S > 5500) {
            getS = "     使用 6 px line";
        }
        if (S > 13500) {
            getS = "     使用 9 px line";
        }
        return getS;
    }
    Line = getS;
    leftGr = win.add("group");
    leftGr.orientation = "column";
    sG5 = leftGr.add("group");
    sG5.alignment = "left";
    Txt7 = sG5.add("staticText", undefined, "ADVICE:" + Line);
    Txt5 = sG5.add("staticText", undefined, "IS: " + dW + "x" + dH);
    sG1 = leftGr.add("group");
    sG1.alignment = "left";
    Txt1 = sG1.add("staticText", undefined, "3 px:");
    baton259 = leftGr.add("group");
    baton259.alignment = "left";
    Generate1 = baton259.add("button", undefined, "x1");
    Generate1.preferredSize.width = b1L;
    Generate2 = baton259.add("button", undefined, "x2");
    Generate2.preferredSize.width = b1L;
    Generate3 = baton259.add("button", undefined, "x3");
    Generate3.preferredSize.width = b1L;
    Generate4 = baton259.add("button", undefined, "x4");
    Generate4.preferredSize.width = b1L;
    sG2 = leftGr.add("group");
    sG2.alignment = "left";
    Txt2 = sG2.add("staticText", undefined, "6 px:");
    baton289 = leftGr.add("group");
    baton289.alignment = "left";
    Generate21 = baton289.add("button", undefined, "x1");
    Generate21.preferredSize.width = b1L;
    Generate22 = baton289.add("button", undefined, "x2");
    Generate22.preferredSize.width = b1L;
    Generate23 = baton289.add("button", undefined, "x3");
    Generate23.preferredSize.width = b1L;
    Generate24 = baton289.add("button", undefined, "x4");
    Generate24.preferredSize.width = b1L;
    sG3 = leftGr.add("group");
    sG3.alignment = "left";
    Txt3 = sG3.add("staticText", undefined, "9 px:");
    baton290 = leftGr.add("group");
    baton290.alignment = "left";
    Generate31 = baton290.add("button", undefined, "x1");
    Generate31.preferredSize.width = b1L;
    Generate32 = baton290.add("button", undefined, "x2");
    Generate32.preferredSize.width = b1L;
    Generate33 = baton290.add("button", undefined, "x3");
    Generate33.preferredSize.width = b1L;
    Generate34 = baton290.add("button", undefined, "x4");
    Generate34.preferredSize.width = b1L;
    Generate1.onClick = function() {
        FSR = 3;
        DSR = 15;
        close = true;
        win.close();
        Method4.main();
    };
    Generate2.onClick = function() {
        FSR = 3;
        DSR = 30;
        close = true;
        win.close();
        Method4.main();
    };
    Generate3.onClick = function() {
        FSR = 3;
        DSR = 40;
        close = true;
        win.close();
        Method4.main();
    };
    Generate4.onClick = function() {
        FSR = 3;
        DSR = 60;
        close = true;
        win.close();
        Method4.main();
    };
    Generate21.onClick = function() {
        FSR = 6;
        DSR = 20;
        close = true;
        win.close();
        Method4.main();
    };
    Generate22.onClick = function() {
        FSR = 6;
        DSR = 35;
        close = true;
        win.close();
        Method4.main();
    };
    Generate23.onClick = function() {
        FSR = 6;
        DSR = 50;
        close = true;
        win.close();
        Method4.main();
    };
    Generate24.onClick = function() {
        FSR = 6;
        DSR = 65;
        close = true;
        win.close();
        Method4.main();
    };
    Generate31.onClick = function() {
        FSR = 9;
        DSR = 30;
        close = true;
        win.close();
        Method4.main();
    };
    Generate32.onClick = function() {
        FSR = 9;
        DSR = 45;
        close = true;
        win.close();
        Method4.main();
    };
    Generate33.onClick = function() {
        FSR = 9;
        DSR = 60;
        close = true;
        win.close();
        Method4.main();
    };
    Generate34.onClick = function() {
        FSR = 9;
        DSR = 75;
        close = true;
        win.close();
        Method4.main();
    };
    closeBtn = leftGr.add("button", undefined, "关闭");
    closeBtn.alignment = "left";
    closeBtn.minimumSize.width = b2L;
    close = false;
    closeBtn.onClick = function() {
        if (ScriptUI.environment.keyboardState.shiftKey) {
            alert("这种修饰方法包括12个频率间隔预设。每行都适合特定的图片像素大小。\ r然后使用X1-X4可以更改润饰强度。\ r \ r建议-自动检查图像大小并建议应用于图片的行。 \ r•图片大小是宽度*高度。这是给高级用户的提示，他们可以根据图像的长宽参数自行选择一个预设。\ r \ r 3,6,9 px线这些预设创建3 px，6 px和9 px的频率间隔。\ r \ r•3像素-小图像行\ r•6像素-中图像\ r•9像素-大图像\ r \ r•X1-轻度修饰\ r•X2，X3-中度修饰\ r •X4-强烈修饰\ r \ r此方法非常适合流修饰：\ r 1.Photoshop中打开类似的照片。\ r 2.选择合适的预设。 \ r 3.用白色的笔刷，选择黑色的蒙版，然后在皮肤上绘画。\ r 4.通过调整不透明度来调整修饰效果。 \ r 5.在剩余的照片中重复相同的步骤。\ r \ r 这些预设已经在大人物肖像上进行了测试，因此“建议”可能会错误地建议您。您不能只遵循此技巧来选择较高或较低的线。\ r \ r示例：\ r如果面板建议您采用6像素线，那么使用3像素线，则修饰可能会变得激烈而自然。自己测试使用吧！");
        } else {
            close = true;
            win.close();
        }
    };
    win.onClose = function() {
        close = true;
    };
    win.show();
    while (close === false) {
        app.refresh();
    }
} else {
    win = new Window("dialog", "快速修饰 4");
    win.orientation = "column";
    b1L = 47;
    b2L = 218;

    function Method4() {
        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);
            desc1.putInteger(PSKey.LayerID, 86);
            executeAction(PSEvent.Make, desc1, dialogMode);
        }

        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.putString(PSKey.Name, "Temp 1");
            desc1.putObject(PSKey.To, PSClass.Layer, desc2);
            executeAction(PSEvent.Set, desc1, dialogMode);
        }

        function step3(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);
        }

        function step4(enabled, withDialog) {
            if (enabled != undefined && !enabled) {
                return;
            }
            var dialogMode = withDialog ? DialogModes.ALL : DialogModes.NO;
            executeAction(sTID("copyToLayer"), undefined, dialogMode);
        }

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

        function step6(enabled, withDialog) {
            if (enabled != undefined && !enabled) {
                return;
            }
            var dialogMode = withDialog ? DialogModes.ALL : DialogModes.NO;
            executeAction(sTID("copyToLayer"), undefined, dialogMode);
        }

        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.putString(PSKey.Name, "Temp 3");
            desc1.putObject(PSKey.To, PSClass.Layer, desc2);
            executeAction(PSEvent.Set, desc1, dialogMode);
        }

        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.putName(PSClass.Layer, "Temp 1");
            desc1.putReference(PSString.Null, ref1);
            desc1.putBoolean(PSKey.MakeVisible, false);
            var list1 = new ActionList();
            list1.putInteger(87);
            desc1.putList(PSKey.LayerID, list1);
            executeAction(PSEvent.Select, desc1, dialogMode);
        }

        function step9(enabled, withDialog) {
            if (enabled != undefined && !enabled) {
                return;
            }
            var dialogMode = withDialog ? DialogModes.ALL : DialogModes.NO;
            var desc1 = new ActionDescriptor();
            desc1.putUnitDouble(PSKey.Radius, PSUnit.Pixels, FSR);
            executeAction(sTID("gaussianBlur"), desc1, dialogMode);
        }

        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.putName(PSClass.Layer, "Temp 2");
            desc1.putReference(PSString.Null, ref1);
            desc1.putBoolean(PSKey.MakeVisible, false);
            var list1 = new ActionList();
            list1.putInteger(88);
            desc1.putList(PSKey.LayerID, list1);
            executeAction(PSEvent.Select, desc1, dialogMode);
        }

        function step11(enabled, withDialog) {
            if (enabled != undefined && !enabled) {
                return;
            }
            var dialogMode = withDialog ? DialogModes.ALL : DialogModes.NO;
            var desc1 = new ActionDescriptor();
            desc1.putInteger(PSKey.Radius, DSR);
            desc1.putInteger(PSKey.Threshold, 0);
            executeAction(sTID("dustAndScratches"), desc1, dialogMode);
        }

        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.putName(PSClass.Layer, "Temp 3");
            desc1.putReference(PSString.Null, ref1);
            desc1.putBoolean(PSKey.MakeVisible, false);
            var list1 = new ActionList();
            list1.putInteger(89);
            desc1.putList(PSKey.LayerID, list1);
            executeAction(PSEvent.Select, desc1, dialogMode);
        }

        function step13(enabled, withDialog) {
            if (enabled != undefined && !enabled) {
                return;
            }
            var dialogMode = withDialog ? DialogModes.ALL : DialogModes.NO;
            var desc1 = new ActionDescriptor();
            desc1.putUnitDouble(PSKey.Radius, PSUnit.Pixels, FSR);
            executeAction(sTID("highPass"), desc1, dialogMode);
        }

        function step14(enabled, withDialog) {
            if (enabled != undefined && !enabled) {
                return;
            }
            var dialogMode = withDialog ? DialogModes.ALL : DialogModes.NO;
            var desc1 = new ActionDescriptor();
            desc1.putInteger(PSKey.Brightness, 0);
            desc1.putInteger(PSKey.Contrast, -50);
            executeAction(sTID("brightnessEvent"), desc1, dialogMode);
        }

        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.putEnumerated(PSKey.Mode, PSType.BlendMode, PSString.linearLight);
            desc1.putObject(PSKey.To, PSClass.Layer, desc2);
            executeAction(PSEvent.Set, desc1, dialogMode);
        }

        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.putName(PSClass.Layer, "Temp 1");
            desc1.putReference(PSString.Null, ref1);
            desc1.putEnumerated(PSString.selectionModifier, PSString.selectionModifierType, PSString.addToSelectionContinuous);
            desc1.putBoolean(PSKey.MakeVisible, false);
            var list1 = new ActionList();
            list1.putInteger(87);
            list1.putInteger(sTID("skinTone"), 90);
            list1.putInteger(sTID("contentAware"), 89);
            desc1.putList(PSKey.LayerID, list1);
            executeAction(PSEvent.Select, desc1, dialogMode);
        }

        function step17(enabled, withDialog) {
            if (enabled != undefined && !enabled) {
                return;
            }
            var dialogMode = withDialog ? DialogModes.ALL : DialogModes.NO;
            var desc1 = new ActionDescriptor();
            executeAction(sTID("mergeLayersNew"), desc1, dialogMode);
        }

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

        function step19(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);
        }

        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.putClass(PSClass.PaintbrushTool);
            desc1.putReference(PSString.Null, ref1);
            executeAction(PSEvent.Select, desc1, dialogMode);
        }
        step1();
        step2();
        step3();
        step4();
        step5();
        step6();
        step7();
        step8();
        step9();
        step10();
        step11();
        step12();
        step13();
        step14();
        step15();
        step16();
        step17();
        step18();
        step19();
        step20();
    }
    cTID = function(s) {
        return app.charIDToTypeID(s);
    };
    sTID = function(s) {
        return app.stringIDToTypeID(s);
    };
    Method4.loadSymbols = function() {
        var dbgLevel = $.level;
        $.level = 0;
        try {
            PSConstants;
            return;
        } 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() {

            };
        }
        PSClass.Channel = cTID("Chnl");
        PSClass.Layer = cTID("Lyr ");
        PSClass.Mask = cTID("Msk ");
        PSClass.PaintbrushTool = cTID("PbTl");
        PSEnum.HideAll = cTID("HdAl");
        PSEnum.Target = cTID("Trgt");
        PSEvent.Make = cTID("Mk  ");
        PSEvent.Select = cTID("slct");
        PSEvent.Set = cTID("setd");
        PSKey.At = cTID("At  ");
        PSKey.Brightness = cTID("Brgh");
        PSKey.Contrast = cTID("Cntr");
        PSKey.Duplicate = cTID("Dplc");
        PSKey.LayerID = cTID("LyrI");
        PSKey.MakeVisible = cTID("MkVs");
        PSKey.Mode = cTID("Md  ");
        PSKey.Name = cTID("Nm  ");
        PSKey.New = cTID("Nw  ");
        PSKey.Radius = cTID("Rds ");
        PSKey.Threshold = cTID("Thsh");
        PSKey.To = cTID("T   ");
        PSKey.Using = cTID("Usng");
        PSString.Null = sTID("null");
        PSString.addToSelectionContinuous = sTID("addToSelectionContinuous");
        PSString.linearLight = sTID("linearLight");
        PSString.selectionModifier = sTID("selectionModifier");
        PSString.selectionModifierType = sTID("selectionModifierType");
        PSType.BlendMode = cTID("BlnM");
        PSType.Ordinal = cTID("Ordn");
        PSType.UserMaskOptions = cTID("UsrM");
        PSUnit.Pixels = cTID("#Pxl");
    };
    Method4.loadSymbols();
    Method4.main = function() {
        Method4();
    };
    docRef = app.activeDocument;
    var dW = docRef.width.as("px");
    var dH = docRef.height.as("px");
    var S = (dW * dH) / 1000;
    if (app) {
        try {
            MainCatch322();
        } catch (e) {
            alert("light");
        }
    }

    function MainCatch322() {
        if (S > 0) {
            getS = "     使用 3 px line";
        }
        if (S > 5500) {
            getS = "     使用 6 px line";
        }
        if (S > 13500) {
            getS = "     使用 9 px line";
        }
        return getS;
    }
    Line = getS;
    leftGr = win.add("group");
    leftGr.orientation = "column";
    sG5 = leftGr.add("group");
    sG5.alignment = "left";
    Txt7 = sG5.add("staticText", undefined, "建议:" + Line);
    Txt5 = sG5.add("staticText", undefined, "IS: " + dW + "x" + dH);
    sG1 = leftGr.add("group");
    sG1.alignment = "left";
    Txt1 = sG1.add("staticText", undefined, "3 px:");
    baton259 = leftGr.add("group");
    baton259.alignment = "left";
    Generate1 = baton259.add("button", undefined, "x1");
    Generate1.preferredSize.width = b1L;
    Generate2 = baton259.add("button", undefined, "x2");
    Generate2.preferredSize.width = b1L;
    Generate3 = baton259.add("button", undefined, "x3");
    Generate3.preferredSize.width = b1L;
    Generate4 = baton259.add("button", undefined, "x4");
    Generate4.preferredSize.width = b1L;
    sG2 = leftGr.add("group");
    sG2.alignment = "left";
    Txt2 = sG2.add("staticText", undefined, "6 px:");
    baton289 = leftGr.add("group");
    baton289.alignment = "left";
    Generate21 = baton289.add("button", undefined, "x1");
    Generate21.preferredSize.width = b1L;
    Generate22 = baton289.add("button", undefined, "x2");
    Generate22.preferredSize.width = b1L;
    Generate23 = baton289.add("button", undefined, "x3");
    Generate23.preferredSize.width = b1L;
    Generate24 = baton289.add("button", undefined, "x4");
    Generate24.preferredSize.width = b1L;
    sG3 = leftGr.add("group");
    sG3.alignment = "left";
    Txt3 = sG3.add("staticText", undefined, "9 px:");
    baton290 = leftGr.add("group");
    baton290.alignment = "left";
    Generate31 = baton290.add("button", undefined, "x1");
    Generate31.preferredSize.width = b1L;
    Generate32 = baton290.add("button", undefined, "x2");
    Generate32.preferredSize.width = b1L;
    Generate33 = baton290.add("button", undefined, "x3");
    Generate33.preferredSize.width = b1L;
    Generate34 = baton290.add("button", undefined, "x4");
    Generate34.preferredSize.width = b1L;
    Generate1.onClick = function() {
        FSR = 3;
        DSR = 15;
        close = true;
        win.close();
        Method4.main();
    };
    Generate2.onClick = function() {
        FSR = 3;
        DSR = 30;
        close = true;
        win.close();
        Method4.main();
    };
    Generate3.onClick = function() {
        FSR = 3;
        DSR = 40;
        close = true;
        win.close();
        Method4.main();
    };
    Generate4.onClick = function() {
        FSR = 3;
        DSR = 60;
        close = true;
        win.close();
        Method4.main();
    };
    Generate21.onClick = function() {
        FSR = 6;
        DSR = 20;
        close = true;
        win.close();
        Method4.main();
    };
    Generate22.onClick = function() {
        FSR = 6;
        DSR = 35;
        close = true;
        win.close();
        Method4.main();
    };
    Generate23.onClick = function() {
        FSR = 6;
        DSR = 50;
        close = true;
        win.close();
        Method4.main();
    };
    Generate24.onClick = function() {
        FSR = 6;
        DSR = 65;
        close = true;
        win.close();
        Method4.main();
    };
    Generate31.onClick = function() {
        FSR = 9;
        DSR = 30;
        close = true;
        win.close();
        Method4.main();
    };
    Generate32.onClick = function() {
        FSR = 9;
        DSR = 45;
        close = true;
        win.close();
        Method4.main();
    };
    Generate33.onClick = function() {
        FSR = 9;
        DSR = 60;
        close = true;
        win.close();
        Method4.main();
    };
    Generate34.onClick = function() {
        FSR = 9;
        DSR = 75;
        close = true;
        win.close();
        Method4.main();
    };
    closeBtn = leftGr.add("button", undefined, "关闭");
    closeBtn.alignment = "left";
    closeBtn.minimumSize.width = b2L;
    close = false;
    closeBtn.onClick = function() {
        if (ScriptUI.environment.keyboardState.shiftKey) {
           alert("这种修饰方法包括12个频率间隔预设。每行都适合特定的图片像素大小。\ r然后使用X1-X4可以更改润饰强度。\ r \ r建议-自动检查图像大小并建议应用于图片的行。 \ r•图片大小是宽度*高度。这是给高级用户的提示，他们可以根据图像的长宽参数自行选择一个预设。\ r \ r 3,6,9 px线这些预设创建3 px，6 px和9 px的频率间隔。\ r \ r•3像素-小图像行\ r•6像素-中图像\ r•9像素-大图像\ r \ r•X1-轻度修饰\ r•X2，X3-中度修饰\ r •X4-强烈修饰\ r \ r此方法非常适合流修饰：\ r 1.Photoshop中打开类似的照片。\ r 2.选择合适的预设。 \ r 3.用白色的笔刷，选择黑色的蒙版，然后在皮肤上绘画。\ r 4.通过调整不透明度来调整修饰效果。 \ r 5.在剩余的照片中重复相同的步骤。\ r \ r 这些预设已经在大人物肖像上进行了测试，因此“建议”可能会错误地建议您。您不能只遵循此技巧来选择较高或较低的线。\ r \ r示例：\ r如果面板建议您采用6像素线，那么使用3像素线，则修饰可能会变得激烈而自然。自己测试使用吧！");
        } else {
            close = true;
            win.close();
        }
    };
    win.onClose = function() {
        close = true;
    };
    win.show();
    while (close === false) {
        app.refresh();
    }
}