论坛帮助 |
社区圈子 |
日历事件 |
2023-04-14, 09:35 | #1 | ||
|
|||
正式会员
等级: 二袋长老
|
name: "cancel" });确认_按钮 = 我的窗口.add("button", [420, 100, 500, 150], "确认(&M)", { name: "ok" });确认_按钮.onClick = function() { var数字 = /^[0-9]+$/; if (颜色_编辑框.text != "" && !数字.test(颜色_编辑框.text) || isNaN(颜色_编辑框.text) == true || 颜色_编辑框.text < 1 || 颜色_编辑框.text > 15) { alert("颜色,只能输入数字。而且小于16。", "颜色错误", 2); return false; } activeDocument.activeLayer = activeDocument.layers[0]; activeDocument.activeLayer.textItem.contents = 版号_编辑框.text; var idsetd = charIDToTypeID("setd"); var desc11 = new ActionDescriptor(); var idnull = charIDToTypeID("null"); var ref2 = new ActionReference(); var idChnl = charIDToTypeID("Chnl"); var idfsel = charIDToTypeID("fsel"); ref2.putProperty(idChnl, idfsel); desc11.putReference(idnull, ref2); var idT = charIDToTypeID("T "); var ref3 = new ActionReference(); var idChnl = charIDToTypeID("Chnl"); var idChnl = charIDToTypeID("Chnl"); var idTrsp = charIDToTypeID("Trsp"); ref3.putEnumerated(idChnl, idChnl, idTrsp); desc11.putReference(idT, ref3); executeAction(idsetd, desc11, DialogModes.NO); var通道长度 = app.activeDocument.channels.length; if (通道长度 != activeDocument.activeChannels.length) { var通道 = "new Array("; for (var a = 0; a < 通道长度; a += 1) { if (a > (通道长度 - 2)) { var通道值 = "activeDocument.channels[" + a + "])"; } else { var通道值 = "activeDocument.channels[" + a + "],"; } var通道 = 通道 + 通道值; } activeDocument.activeChannels = eval(通道); } var新颜色 = new SolidColor();新颜色.cmyk.cyan = 0;新颜色.cmyk.magenta = 0;新颜色.cmyk.yellow = 0;新颜色.cmyk.black = 100; activeDocument.selection.fill(新颜色, ColorBlendMode.NORMAL, 100, false); activeDocument.selection.deselect(); activeDocument.channels[0].remove(); activeDocument.channels[0].remove(); activeDocument.channels[0].remove(); activeDocument.channels[0].remove(); var通道长度 = activeDocument.channels.length; var颜色数 = 颜色_编辑框.text; for (var a = 0; a < 通道长度 - 颜色数; a += 1) { activeDocument.channels[颜色数].remove(); }我的窗口.close(); };我的窗口.center();我的窗口.show(); |
||
2023-04-14, 15:06 | 只看该作者 #2 | ||
|
|||
正式会员
等级: 四袋长老
|
引用:
var idT = charIDToTypeID("T "); 这行有问题 PS脚本我不熟这个我不知道是啥意思 卡这了 后面我不知道有没有问题 |
||