illustrator插件色标生成器AI插件
1 方法原理
illustrator是矢量编辑软件,画板是绘制处理的重要容器,在印刷方面的一个重要功能就是色标生成器,开发一个 色标生成器功能 ,以下功能仅用于学习交流,请勿用于非法用途和商业用途,源代码如下所示: 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", " 53656c65637420416c6c20556e75736564", "]", "/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", " 44656c65746520537761746368", "]", "/value 3", "}", "}", "}"].join(" "); var win = new Window("dialog", "(CJ)AI_色号生成器V2.2scD", undefined); win.alignChildren = "fill"; win.spacing = 5; var abIcon = "‰PNGr rIHDR +v tEXtSoftwareAdobe ImageReadyqÉe< gIDATxÚ"U]L›e ~úÿµ"òñ_Ú ¿)Ð p k Hq!–É2."Ãzåî6¹Ü¼äÆ+â¼r‰Ù Ðx¡²‹M‰Ù $j ‰Œ c„]")?V~V ¿žó–2ºà "yó}mß yŸóœçœªðê¡x< _f(^å úe? †A½^? ÕjŸÑòû|¾ ½½½ è= ÓéüôÛ $I þOȲÜf X ÒJ §»:;ÓCCCélð{{{{º¼ ,Í{ Æå q4/~QQQ1 Ñh¾-)) EÁk§Natt EEEb ÝnG @ Í ³ÙŒ½½=·Z öÒE?íììüu,x]] ß Z hnn†ÛíÆÀÀº»»ÑØ؈ðßqè6 p TWW3 D QqA8 ¶RR^"5 ½½ Í w¹ 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.// &" 555 ÍÄât)Mü Áb" ÍH X%æ‹$ÍÏ{ Ì<»—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ôÄ!Ç{ {Ÿ :?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" `f2 ă.ütW TsE‘b " DãÆ: ý"œÞÚ ãº / ’ Îl +++3 Bð+ %pvv†‚ 7 ¶Êª*(++SöíÆb𠆾 ‡X,Öƒ{½i œ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 ’ VÝç––º.>é&ý)k L&Ø "½WÓ 0› Y‚ÒòrÐ[ãqM5 š $ɉƒã Ú Ó @š=ÅæxSül {hnÔÁ "À Ë ]: šdT0 ECÌD QÈÏÏ æH ³0Þïd Ï`AI ::Ò:Bö!m ý ƒQ „"öÁKa ¾-,(ãg$ ÿi/ 8, úÊz’cU ÞÅ‘ Ô¡úU îî u¶¡i ^ô]ïÆ(—||/nû,Š Ç•õ:»C P êP5é ` õnËò æ S Ràp]D "8u‹ŠI F ‘.‰l à è· ÖŠƒ Ç;É}š.m û. KËË 8ƒÁ —óÊ ÔB‘·· Ñ ö1 ú K Œ åT Þli!r 8" 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¼ Þ" (ž &ß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; } } } }2.使用方式
AI源代码转执行脚本
>文章引用至 作者联系方式
作为初创企业,亿咖通科技是如何成为独角兽企业的?亿咖通科技已经成立了5年了,在这5年中,亿咖通科技取得了一个又一个的技术成就,正是由于这些成就,才使得亿咖通科技成为了人人羡慕的独角兽企业。那么亿咖通科技作为初创企业,都取得了什么
沈子瑜亿咖通科技的智能座舱,构建领先的智能化出行亿咖通科技沈子瑜说传统汽车座舱是冷冰冰没有温度的乘坐空间。亿咖通科技沈子瑜说随着5G和人工智能到来,良好的座舱空间可帮助驾乘人员更好的享受美好生活。因此,沈子瑜表示,亿咖通科技聚焦
喜大普奔,低价位的哈曼参考级耳机来了自然声NS4耳机自己曾经发布过一只价格非常便宜(不到300元)的音特美参考级耳机,自然声NS3R。发布后深受用户欢迎!现在又一只参考级哈曼曲线的中端入耳式耳机发售了,在此也做些介绍,希望大家喜欢!
65万女性受害!网络再现一键软件,人工智能最无耻的应用之一你知道吗,你发在社交平台上的照片很有可能被人盯上了,可怕的是你的身体的隐私会在你不知情的情况下被登上网络上传播。这就是曾经爆红的AI一键脱衣软件A(为了避免引流,就不打网站名字了)
美科技公司破解刷脸支付?网友用照片实验,屏幕出现四个字随着科技的发展,我们的支付方式也在发生着翻天覆地地变化,如今人们消费基本依靠手机支付,而中国的移动支付在世界上处在了领先位置。移动支付正在改变着社会中的每一个人,相信大家都深有感触
国庆小长假,新能源汽车车主苦不堪言!千算万算还是半路歇菜国庆小长假刚过去,每年关于高速塞车的新闻已经屡见不鲜,尽管这样也还是无法阻挡人们出游的决心。今年的新闻却有点不一样,在赛车阵营中,新能源车的车主尤为显眼。此次国庆,他们可谓是苦不堪
2020年成都音响展十佳房间总结2020年10月30号至11月1日,自己参加了成都国际音响展。也参观了各展房,在此也总结一下十佳展房。希望大家喜欢!十自然声房间这次自己带着NS16NS17音箱,A50功放DAC1
加进案例小程序上线10天创造百万级交易额在线上流量获客成本攀升的当下,电商平台急需新的流量池,于是乎瞄向了社交。一方面社交电商价低甚至是免费的,另一方面社交平台获取的流量更直观持续,再者人际的信任加权,转化率更高。今天来
加进案例米米大吉拼团小程序获取流量的最时髦打法在一二线城市的互联网流量接近负荷,它们纷纷下沉寻求新的增长空间,而拼购业务又被看作是最有效之策。在流量红利逐渐耗尽的后电商时代,凭靠低价和社交,抢占低线市场。拼团玩法的好处就是以低
小米终于选对代言人了在2020东京奥运会中,苏炳添跑出了9秒83的成绩,刷新了亚洲纪录!小米在8月10日也官宣了现今中国最快百米飞人苏炳添成为小米代言人!关于小米的代言史,可以说是充满了崎岖不平,很长
淘宝slogan更新背后也太会玩了吧9月1日下午,太了吧体突然上了热搜。太了吧体究竟是怎么火起来的?这还要从8月30日,淘宝官方微博宣布更换新slogan,在微博上,淘宝不仅官宣新slogan,还开启了与多个品牌的全