illustrator插件--常用功能开发--色标生成器--js脚本开发--AI插件

var doc = app.activeDocument;
app.coordinateSystem = CoordinateSystem.ARTBOARDCOORDINATESYSTEM;
doc.rulerOrigin = [0, doc.height];
var lay = doc.activeLayer;
var ab = doc.artboards;
var arrSpotColor = new Array();
doc.selection = null;
var doc = app.activeDocument;
var swaSpot = doc.spots;
for (var i = 0; i < swaSpot.length; i += 1) {
    if (swaSpot[i].colorType == "ColorModel.REGISTRATION") {
        regName = swaSpot[i].name;
        break;
    }
}
var col1 = new CMYKColor();
col1.black = 0;
col1.magenta = 0;
col1.cyan = 100;
col1.yellow = 0;
var col2 = new CMYKColor();
col2.black = 0;
col2.magenta = 100;
col2.cyan = 0;
col2.yellow = 0;
var col3 = new CMYKColor();
col3.black = 0;
col3.magenta = 0;
col3.cyan = 0;
col3.yellow = 100;
var col4 = new CMYKColor();
col4.black = 100;
col4.magenta = 0;
col4.cyan = 0;
col4.yellow = 0;
var colAll = new Array();
colAll[0] = col1;
colAll[1] = col2;
colAll[2] = col3;
colAll[3] = col4;
var set = "Set_ClearUnuseSwatches";
var action1 = "Action_ClearUnuseSwatches";
var actionStr1 = ["/version 3", "/name [ 22", "5365745f436c656172556e7573655377617463686573", "]", "/isOpen 1", "/actionCount 1", "/action-1 {", "/name [ 25", "416374696f6e5f436c656172556e7573655377617463686573", "]", "/keyIndex 0", "/colorIndex 0", "/isOpen 1", "/eventCount 2", "/event-1 {", "/useRulersIn1stQuadrant 0", "/internalName (ai_plugin_swatches)", "/localizedName [ 8", "5377617463686573", "]", "/isOpen 0", "/isOn 1", "/hasDialog 0", "/parameterCount 1", "/parameter-1 {", "/key 1835363957", "/showInPalette -1", "/type (enumerated)", "/name [ 17", "\t53656c65637420416c6c20556e75736564", "]", "/value 11", "}", "}", "/event-2 {", "/useRulersIn1stQuadrant 0", "/internalName (ai_plugin_swatches)", "/localizedName [ 8", "5377617463686573", "]", "/isOpen 0", "/isOn 1", "/hasDialog 1", "/showDialog 0", "/parameterCount 1", "/parameter-1 {", "/key 1835363957", "/showInPalette -1", "/type (enumerated)", "/name [ 13", "\t44656c65746520537761746368", "]", "/value 3", "}", "}", "}"].join("\n");
var win = new Window("dialog", "(CJ)AI_色号生成器V2.2scD", undefined);
win.alignChildren = "fill";
win.spacing = 5;
var abIcon = "�PNG\r\n�\n\rIHDR���+v���tEXtSoftwareAdobe ImageReadyqÉe<�gIDATxÚ�U]L�e�~úÿµ�òñ_Ú��¿)Ð�p\tk�Hq!�É2.\\\"Ã�zåî6¹Ü¼äÆ+â¼r�Ù¸Ðx¡²�M�Ù�$j¢��¨c�]�)?V~V�´¥¿�ó�2ºà�'yó}mß÷y�ó�ç�ªðê¡x<�
_f(^å�úe?��A½^?©Õj�Ñòû|¾�½½½�è=­ÓéüôÛ¸$I\nþOȲÜf±X�ÒJ××ק»:;ÓCCCélð{{{{º¼¬,Í{\n\n\nÆ���å�q4/~QQQ1¢Ñh¾-))±��EÁk§Natt�EEEb�ÝnG �@
Í�³Ù�½½=·Z­öÒE?íììüu,x]]��ß´Z­hnn�ÛíÆÀÀº»»ÑØØ�ðßqè6�p¸�TWW3�D£QqA8�¶RR^\"5±½½�Í�w¹\\\n�O���JÌÖëõ¢££�uGmm­xþ��Ãö�ÎÕK ½H¥Rhmmeæâ��²J¥rollLä�WUU��%Éí¨¬D__��N§8À¬���üÉ4�¡�j�Ä��&»EH��ÅÄåkkkb�4�QlvûSú</ÜÒÓÓ£��Æ�Ò²2¾�6Ò2��EÅB\"�Àt$�­H�XOÓ!A¨¼¼üp�KG�£¨¸��uùÐ��Y.//�&�\t555 ÍÄât)Mü°�Áb\"
ÍH\nX%æ�$ÍÏ{¢°Ì<»�34���·õ{½�§�ç��ue�[[[b���«/âÀJ2
\rf¾�ˬ¯¶3�EõÉîg�^��Ñ�$y´�Üd�©Ò¢HÌB¤¤V��f£qü�R��Eiø���sa8�����̱3��¥�aN7µ1�GV�H$�õõu|i�±J¬ym2óÕøóõy&»���Ãs��-Ø�æ�Ñ8�J§Ûس¬!�ù�!���ó©ñ�C�¯Å�Sü8|`CSS�¦¦¦��\rÐxÈ��VA�
�ÙNÉd�»»»pvªqU÷áá¡_~�pÝ�Î�àôT�§ßy]H��üü|6²ö@�YºÉÃEáØßßG(�»ÎïáÒo���~dÅõ�)�¼oú��Î�½°° dbç%S©�õA�·Ø£|#��³K$CôÄ!Ç{��{�\n:?66¶,À¯^»¶LÝ9SG�ÆA£T�ÿ±ª9��½�\rö¸�¼Oà�åÌsJÇGC'ØÒÒ\"2`ðO?3�~và-Ñ@KKK<�Ø�3�¯\\¹��þÞ¥KËdü÷yNð¨å�po6�¯ïZþ�xàÜ9Ô�\rÙ)]]] ¡�¤n÷�;r©�æ/�\r=¥?�A�\\sssøæ��ÏB2��öñÝ´�Õu-ò©>o_¸�7Ïö#I.á~(�åejÂþ�ÃÃ�Y<Õq�î޹㡦ºIé*�ܸ�¿ß�2�jÅ4�¸`<SøYIz³�ɾ·iù(�àQ�ÕËô�¾���üzþÏ��ÁÇd3ö²�êa£?\t��A*ümê��7Î�9ö�û_��¤wæ¢\nrÂxIEND®B`�";
var pan1 = win.add("panel", undefined, "选色");
pan1.alignChildren = "top";
pan1.orientation = "row";
var pan11 = pan1.add("panel", undefined, "CMYK四原色(中英文)");
pan11.alignChildren = "left";
pan11.spacing = 3;
var gi11 = pan11.add("group");
gi11.orientation = "row";
gi11.alignChildren = "left";
var rb113 = gi11.add("radiobutton", undefined, "无");
var rb111 = gi11.add("radiobutton", undefined, "全部");
rb111.value = true;
var rb112 = gi11.add("radiobutton", undefined, "自定");
var gi12 = pan11.add("group");
var cb121 = gi12.add("checkbox", undefined, "C");
var cb122 = gi12.add("checkbox", undefined, "M");
var cb123 = gi12.add("checkbox", undefined, "Y");
var cb124 = gi12.add("checkbox", undefined, "K");
var spacePan11 = pan11.add("panel", [0, 0, undefined, 2], "");
spacePan11.alignment = "fill";
var gi13 = pan11.add("group");
var cb131 = gi13.add("checkbox", undefined, "只列英文");
var cb132 = gi13.add("checkbox", undefined, "只列中文");
cb121.enabled = cb122.enabled = cb123.enabled = cb124.enabled = false;
cb121.value = cb122.value = cb123.value = cb124.value = true;
rb111.onClick = function () {
    rb111.value == true;
    cb121.value = cb122.value = cb123.value = cb124.value = cb131.enabled = cb132.enabled = true;
    cb121.enabled = cb122.enabled = cb123.enabled = cb124.enabled = false;
};
rb112.onClick = function () {
    rb112.value == true;
    cb121.value = cb122.value = cb123.value = false;
    cb124.value = true;
    cb121.enabled = cb122.enabled = cb123.enabled = cb124.enabled = cb131.enabled = cb132.enabled = true;
};
rb113.onClick = function () {
    rb111.value == true;
    cb121.value = cb122.value = cb123.value = cb124.value = cb131.value = cb132.value = false;
    cb121.enabled = cb122.enabled = cb123.enabled = cb124.enabled = cb131.enabled = cb132.enabled = false;
};
var pan12 = pan1.add("panel", undefined, "特别色");
pan12.spacing = 4.5;
var gi12 = pan12.add("group");
gi12.orientation = "row";
gi12.alignment = "left";
var rb121 = gi12.add("radiobutton", undefined, "无");
var rb122 = gi12.add("radiobutton", undefined, "全部");
rb122.value = true;
var cb1221 = pan12.add("checkbox", undefined, "简化PANTONE名称");
var spacePan12 = pan12.add("panel", [0, 0, undefined, 2], "");
spacePan12.alignment = "fill";
var st1221 = pan12.add("statictext", undefined, "(例:871 C 186 C ...)");
st1221.alignment = "right";
var pan2 = win.add("panel", undefined, "相关选项");
pan2.alignChildren = "fill";
var pan21 = pan2.add("panel", undefined, "排列方式");
var gi21 = pan21.add("group");
gi21.orientation = "row";
gi21.alignment = "left";
var rb211 = gi21.add("radiobutton", undefined, "一排");
rb211.value = true;
var rb212 = gi21.add("radiobutton", undefined, "两排");
var pan22 = pan2.add("panel", undefined, "位置");
var gi22 = pan22.add("group");
gi22.orientation = "row";
gi22.alignment = "left";
var rb221 = gi22.add("radiobutton", undefined, "置于屏幕正中");
rb221.value = true;
var rb222 = gi22.add("radiobutton", undefined, "置于页面左上角外");
var rb223 = gi22.add("radiobutton", undefined, "手动黏贴");
var pan23 = pan2.add("panel", undefined, "其他");
var gi23 = pan23.add("group");
gi23.orientation = "row";
gi23.alignment = "left";
var cb231 = gi23.add("checkbox", undefined, "选取状态");
cb231.value = true;
var cb232 = gi23.add("checkbox", undefined, "两者再编组");
cb232.value = true;
var cb233 = gi23.add("checkbox", undefined, "色号后附加油墨总数");
cb233.value = true;
var giEnd = win.add("group");
giEnd.alignment = "center";
var okBtn = giEnd.add("button", undefined, "运行", {
    name: "ok"
});
var cancelBtn = giEnd.add("button", undefined, "取消", {
    name: "cancel"
});
var spacePan2 = win.add("panel", [0, 0, undefined, 2], "");
var giSign = win.add("group");
giSign.spacing = 0;
giSign.alignment = "center";
var cpcImg = "�PNG\r\n�\n\rIHDR(��d×=­�tEXtSoftwareAdobe ImageReadyqÉe<�ÄIDATxÚÌVËO�a���ÚÖ�Ù\n�ÑmÏCY¸\\l��yĤÜ�[IÆ�ÒxE��@à`D��!h4áe¤âÁ.^@\"¡
��8l�°õa#�Z�Å�åÛ¥�-���|Ùô{Ío~ó�ù\npÂ-+uâ^Û]�?�������G�Ç«§}Ï�Sö¶ã�;â~:;�çä�s6æ�g~�\t>f2�Ä�.ütW¯TsE�b¸°���DãÆ:�ý\"�ÞÚ\nãº�/\t��Îl�+++3¢�
Bð+�%pvv���7��¶Êª*(++SöíÆbð�÷�¾��X,Ö�{½i\t�iÏ4pgº\r�\"E��kû��ó¦¦ ïÃ�â��³X,¢»µõÈ�ÍÍÎÂG���£HD�&Ô74�L§[�áõÈ�E¬»i.;!­��÷Þ$p©¶ÙØÛ��±Ð­�Ot��¤¤¹�ÚZ@¦é~����ÍͺàÈ8��Û�0®»X6�¢ubZ¡p³PÛ<_ò�zoô@aßsLñÆ!ȦFøk2Ù�>�,°¸/ûûá\r²�hfN�©`w8´9L%���Áî�ý~å7��¯G\"�F5�6k¸B;,Zý0l��×\nVÝç��º.>é&ý)k�L&Ø��½WÓ�0��Y�ÒòrÐ[ãqM5\n����$É��㣣Ú�Ó¦@�=ÅæxSül�{hnÔÁ��À¥Ë��]:��dT0©ECÌD£QÈÏÏ×æH�¨³0Þïd÷Ï`AI�::Ò:Bö!m�±ý¬�Q���öÁKa\t¾-,(ãg$�ÿi/�8,�úÊz�cU­ÞÅ��Ô¡úU�îî��u¶¡i�^ô]ïÆ�(�||/nû,���Ç�õ:»C�P �� êP5é `¨¯õnËò¸æ�S�Ràp]D��8u��I�F��.�l�à¤è·\nÖ��\n¤¯Ç;É}�.m�û.�KËË�8�Á��óÊ�ÔB�··\t�ѯö1�ú�K£�©åT�Þli!\r\n8'�f�¥A­��£�¯�ìY[-ðÌÏ�pWjV��¢â��Êû�d�êìv0�1̰ίÛmR_�f½>�¯�µ�e�k4�\rµ©�ìÒ4È�\"÷ð��©µêz%æ(µ�ÞBÀ�Ç}SÑÇct>AÕKýRϨxh�½&3zO�¥l 7w�'&××�ã�ó���£¤�1GO�Ì�{@§X¼¸Þ�\t(�£&ßNO�5fj?$\r��ò ä]�ç³2\\âb}�W��4�!uÇ6��+¡��°/z�,N¼ý�` �²Ö�ñºÈIEND®B`�";
var imgSign = giSign.add("image", undefined, cpcImg);
var stSign = giSign.add("statictext", undefined, "CPC中印 ");
var stSign2 = giSign.add("statictext", undefined, " by calvin530126");
okBtn.onClick = function () {
    txt4C = txtSpot = "";
    if (rb113.value == true && rb121.value == true) {
        alert("请勿两种色号同时勾选'无'");
        rb111.value = rb122.value = true;
        return false;
    } else {
        if (rb111.value == true || rb112.value == true || rb122.value == true) {
            actAbIndex = ab.getActiveArtboardIndex();
            var abSize = ab[actAbIndex].artboardRect;
            if (rb111.value == true || rb112.value == true) {
                for4cInfo();
                var all4ColorSum = 4;
                var txt4cLen = Number(txt4C.contents.length);
                if (cb121.value == false) {
                    all4ColorSum = all4ColorSum - 1;
                    if (txt4cLen == 20) {
                        var result = txt4C.contents.lastIndexOf("蓝色(C)");
                        for (i = result; i < (result + 5); i++) {
                            txt4C.textRange.characters[result].remove();
                        }
                    }
                    if (txt4cLen == 8) {
                        var result = txt4C.contents.lastIndexOf("蓝色");
                        for (i = result; i < (result + 2); i++) {
                            txt4C.textRange.characters[result].remove();
                        }
                    }
                    if (txt4cLen == 4) {
                        var result = txt4C.contents.lastIndexOf("C");
                        for (i = result; i < (result + 1); i++) {
                            txt4C.textRange.characters[result].remove();
                        }
                    }
                }
                if (cb122.value == false) {
                    all4ColorSum = all4ColorSum - 1;
                    if (txt4cLen == 20) {
                        var result = txt4C.contents.lastIndexOf("洋红(M)");
                        for (i = result; i < (result + 5); i++) {
                            txt4C.textRange.characters[result].remove();
                        }
                    }
                    if (txt4cLen == 8) {
                        var result = txt4C.contents.lastIndexOf("洋红");
                        for (i = result; i < (result + 2); i++) {
                            txt4C.textRange.characters[result].remove();
                        }
                    }
                    if (txt4cLen == 4) {
                        var result = txt4C.contents.lastIndexOf("M");
                        for (i = result; i < (result + 1); i++) {
                            txt4C.textRange.characters[result].remove();
                        }
                    }
                }
                if (cb123.value == false) {
                    all4ColorSum = all4ColorSum - 1;
                    if (txt4cLen == 20) {
                        var result = txt4C.contents.lastIndexOf("黄色(Y)");
                        for (i = result; i < (result + 5); i++) {
                            txt4C.textRange.characters[result].remove();
                        }
                    }
                    if (txt4cLen == 8) {
                        var result = txt4C.contents.lastIndexOf("黄色");
                        for (i = result; i < (result + 2); i++) {
                            txt4C.textRange.characters[result].remove();
                        }
                    }
                    if (txt4cLen == 4) {
                        var result = txt4C.contents.lastIndexOf("Y");
                        for (i = result; i < (result + 1); i++) {
                            txt4C.textRange.characters[result].remove();
                        }
                    }
                }
                if (cb124.value == false) {
                    all4ColorSum = all4ColorSum - 1;
                    if (txt4cLen == 20) {
                        var result = txt4C.contents.lastIndexOf("黑色(K)");
                        for (i = result; i < (result + 5); i++) {
                            txt4C.textRange.characters[result].remove();
                        }
                    }
                    if (txt4cLen == 8) {
                        var result = txt4C.contents.lastIndexOf("黑色");
                        for (i = result; i < (result + 2); i++) {
                            txt4C.textRange.characters[result].remove();
                        }
                    }
                    if (txt4cLen == 4) {
                        var result = txt4C.contents.lastIndexOf("K");
                        for (i = result; i < (result + 1); i++) {
                            txt4C.textRange.characters[result].remove();
                        }
                    }
                }
            }
            if (rb122.value == true) {
                createAction(actionStr1, set);
                app.loadAction(f);
                f.remove();
                app.doScript(action1, set);
                app.unloadAction(set, "");
                forSpotColorInfo();
                if (txtSpot == "") {
                    alert("此档案没有使用特别色");
                }
            }
            if (rb113.value == true) {
                all4ColorSum = 0;
            }
            if (rb121.value == true) {
                arrSpotColor.length = 0;
            }
            var allColorSum = Number(arrSpotColor.length) + Number(all4ColorSum);
            if (allColorSum != 0 && cb233.value == true) {
                txtForAllColorSum = doc.textFrames.add();
                txtForAllColorSum.stroked = false;
                txtForAllColorSum.filled = true;
                txtForAllColorSum.textRange.fillColor = doc.swatches[regName].color;
                txtForAllColorSum.textRange.size = 10;
                txtForAllColorSum.textRange.characterAttributes.textFont = app.textFonts.MicrosoftYaHei;
                txtForAllColorSum.contents = "(共" + allColorSum + "色)";
            }
            if (rb122.value == true && txtSpot != "") {
                if (rb211.value == true) {
                    txt4C.top = abSize[0] + txt4C.height;
                }
                if (rb212.value == true) {
                    txt4C.top = abSize[0] + txt4C.height + txtSpot.height;
                    txt4C.left = abSize[1];
                }
            } else {
                if (rb122.value == false) {
                    txt4C.top = abSize[0] + txt4C.height;
                    txt4C.left = abSize[1];
                }
            }
            if (txtSpot != null) {
                if (rb211.value == true) {
                    if (txt4C == "") {
                        txtSpot.top = abSize[0] + txtSpot.height;
                        txtSpot.left = abSize[1];
                    } else {
                        if (txt4C != "") {
                            txtSpot.top = abSize[0] + txtSpot.height;
                            txtSpot.left = txt4C.width + abSize[1] + 2;
                        }
                    }
                }
                if (rb212.value == true) {
                    txtSpot.top = abSize[0] + txtSpot.height;
                    txtSpot.left = abSize[1];
                }
            }
            if (cb233.value == true) {
                if (rb211.value == true) {
                    txtForAllColorSum.top = abSize[0] + txtForAllColorSum.height;
                    if (rb113.value != true && rb121.value != true) {
                        txtForAllColorSum.left = txt4C.width + txtSpot.width + abSize[1] + 2;
                    }
                    if (rb113.value == true && txtSpot != "") {
                        txtForAllColorSum.left = txtSpot.width + abSize[1] + 2;
                    }
                    if (rb121.value == true && txt4C != "") {
                        txtForAllColorSum.left = txt4C.width + abSize[1] + 2;
                    }
                } else {
                    if (rb212.value == true) {
                        if (rb113.value != true && rb121.value != true) {
                            txtForAllColorSum.top = abSize[0] + txtForAllColorSum.height;
                            txtForAllColorSum.left = txtSpot.width + abSize[1] + 2;
                        }
                        if (rb113.value == true && txtSpot != "") {
                            txtForAllColorSum.top = abSize[0] + txtForAllColorSum.height;
                            txtForAllColorSum.left = txtSpot.width + abSize[1] + 2;
                        }
                        if (rb121.value == true && txt4C != "") {
                            txtForAllColorSum.top = abSize[0] + txtForAllColorSum.height;
                            txtForAllColorSum.left = txt4C.width + abSize[1] + 2;
                        }
                    }
                }
            }
            if (cb232.value == true) {
                giAllTxt = doc.activeLayer.groupItems.add();
                if (rb211.value == true || rb212.value == true) {
                    if (rb113.value != true && rb121.value != true) {
                        txt4C.move(giAllTxt, ElementPlacement.INSIDE);
                        txtSpot.move(giAllTxt, ElementPlacement.INSIDE);
                    }
                    if (rb113.value == true && txtSpot != "") {
                        txtSpot.move(giAllTxt, ElementPlacement.INSIDE);
                    }
                    if (rb121.value == true && txt4C != "") {
                        txt4C.move(giAllTxt, ElementPlacement.INSIDE);
                    }
                }
                if (cb233.value == true) {
                    txtForAllColorSum.move(giAllTxt, ElementPlacement.INSIDE);
                }
            }
            if (txt4C != null) {
                txt4C.selected = true;
            }
            if (txtSpot != null) {
                txtSpot.selected = true;
            }
            if (txtForAllColorSum != null) {
                txtForAllColorSum.selected = true;
            }
            if (rb221.value == true) {
                if (txt4C != null) {
                    txt4C.selected = true;
                }
                if (txtSpot != null) {
                    txtSpot.selected = true;
                }
                app.executeMenuCommand("cut");
                app.executeMenuCommand("paste");
                if (cb231.value == false) {
                    doc.selection = null;
                }
            }
            if (rb223.value == true) {
                if (txt4C != "") {
                    txt4C.selected = true;
                }
                if (txtSpot != "") {
                    txtSpot.selected = true;
                }
                app.executeMenuCommand("cut");
            }
        }
    }
    win.close();
};
win.center();
win.show();

function createAction(act, set) {
    f = new File("~/Desktop/" + set + ".aia");
    f.open("w");
    f.write(act);
    f.close();
    f.hidden = true;
}

function for4cInfo() {
    txt4C = lay.textFrames.add();
    txt4C.fillColor = true;
    txt4C.strokeColor = false;
    txt4C.textRange.size = 10;
    if (cb131.value == false && cb132.value == false) {
        txt4C.contents = "蓝色(C)洋红(M)黄色(Y)黑色(K)";
    } else if (cb131.value == true && cb132.value == true) {
        txt4C.contents = "蓝色(C)洋红(M)黄色(Y)黑色(K)";
    } else if (cb131.value == true && cb132.value == false) {
        txt4C.contents = "CMYK";
    } else {
        if (cb131.value == false && cb132.value == true) {
            txt4C.contents = "蓝色洋红黄色黑色";
        }
    }
    var cha = txt4C.textRange.characters.length;
    txt4C.textRange.characterAttributes.textFont = app.textFonts[textFonts.name = "MicrosoftYaHei"];
    var j = 0;
    var cd = 0;
    for (var i = 0; i < cha; i += 1) {
        txt4C.textRange.characters[i].characterAttributes.fillColor = colAll[j];
        cd++;
        if (cb131.value == false && cb132.value == false && (cd % 5) == 0) {
            j++;
        } else if (cb131.value == true && cb132.value == true && (cd % 5) == 0) {
            j++;
        } else if (cb131.value == true && cb132.value == false && (cd % 1) == 0) {
            j++;
        } else {
            if (cb131.value == false && cb132.value == true && (cd % 2) == 0) {
                j++;
            }
        }
    }
}

function forSpotColorInfo() {
    var col = doc.swatches;
    var colLen = col.length;
    for (var i = 0; i < colLen; i += 1) {
        if (col[i].color.typename == "SpotColor" && col[i].color.spot.colorType == ColorModel.SPOT) {
            arrSpotColor.push(i)
        }
    }
    if (arrSpotColor.length != 0) {
        txtSpot = lay.textFrames.add();
        txtSpot.textRange.size = 10;
        txtSpot.textRange.characterAttributes.textFont = app.textFonts[textFonts.name = "MicrosoftYaHei"];
        for (var j = 0; j < arrSpotColor.length; j += 1) {
            var num = eval(arrSpotColor[j]);
            if (col[num].name.search(/PANTONE/i) != -1 && cb1221.value == true) {
                spotnameTem = col[num].name.slice(7, col[num].name.length);
            } else {
                spotnameTem = col[num].name;
            }
            txtSpot.textRange.characters.add(spotnameTem);
            var txtLength = txtSpot.contents.length;
            for (i = txtLength - spotnameTem.length; i < txtLength; i++) {
                txtSpot.textRange.characters[i].characterAttributes.fillColor = col[num].color;
            }
        }
    }
}

  合理的脚本代码可以有效的提高工作效率,减少重复劳动。

资料信息.jpg
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 204,530评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 86,403评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,120评论 0 337
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,770评论 1 277
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,758评论 5 367
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,649评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,021评论 3 398
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,675评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,931评论 1 299
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,659评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,751评论 1 330
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,410评论 4 321
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,004评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,969评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,203评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,042评论 2 350
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,493评论 2 343