有没有 能直接排刀的 天地盖脚本?
◆- Adobe插件与脚本区 主要讨论Adobe插件开发与软件脚本撰写

Post New Thread Closed Thread
 
Show Post by User Thread Tools
Old 2023-04-27, 13:29     #1
zhizun99 zhizun99 is offline
正式会员
等级: 七袋长老
级别:111 | 在线时长:12985小时 | 升级还需:7小时级别:111 | 在线时长:12985小时 | 升级还需:7小时级别:111 | 在线时长:12985小时 | 升级还需:7小时级别:111 | 在线时长:12985小时 | 升级还需:7小时级别:111 | 在线时长:12985小时 | 升级还需:7小时级别:111 | 在线时长:12985小时 | 升级还需:7小时级别:111 | 在线时长:12985小时 | 升级还需:7小时级别:111 | 在线时长:12985小时 | 升级还需:7小时级别:111 | 在线时长:12985小时 | 升级还需:7小时级别:111 | 在线时长:12985小时 | 升级还需:7小时级别:111 | 在线时长:12985小时 | 升级还需:7小时级别:111 | 在线时长:12985小时 | 升级还需:7小时
 
Uid: 3960
Join Date: 2005-07-21, 15:35
Posts: 4,207
Thanks: 164
Thanked 272 Times in 219 Posts
Cash: 32金币
Assets: 17848金币
Reputation: 12 zhizun99 即将成功的新星
zhizun99 zhizun99 is offline
正式会员
等级: 七袋长老
级别:111 | 在线时长:12985小时 | 升级还需:7小时级别:111 | 在线时长:12985小时 | 升级还需:7小时级别:111 | 在线时长:12985小时 | 升级还需:7小时级别:111 | 在线时长:12985小时 | 升级还需:7小时级别:111 | 在线时长:12985小时 | 升级还需:7小时级别:111 | 在线时长:12985小时 | 升级还需:7小时级别:111 | 在线时长:12985小时 | 升级还需:7小时级别:111 | 在线时长:12985小时 | 升级还需:7小时级别:111 | 在线时长:12985小时 | 升级还需:7小时级别:111 | 在线时长:12985小时 | 升级还需:7小时级别:111 | 在线时长:12985小时 | 升级还需:7小时级别:111 | 在线时长:12985小时 | 升级还需:7小时
 
Uid: 3960
Join Date: 2005-07-21, 15:35
Posts: 4,207
Thanks: 164
Thanked 272 Times in 219 Posts
Cash: 32金币
Assets: 17848金币
Reputation: 12 zhizun99 即将成功的新星
Default 有没有 能直接排刀的 天地盖脚本?   



这个只能说看个样子。


if (app.documents.length > 0) {
var win = new Window("dialog", "天地盖专用");
var panelMargins = win.add("panel", undefined, "盒子尺寸");
var lblMargins = panelMargins.add("statictext", undefined, "天地盖专用:");
var hezichang = panelMargins.add("group");
var Lchang = hezichang.add("statictext", undefined, "盒子长度:");
var Editchang = hezichang.add("edittext", undefined, 220);
var LchangUn = hezichang.add("statictext", undefined, "mm");
var hezikuang = panelMargins.add("group");
var Lkuang = hezikuang.add("statictext", undefined, "盒子盖宽:");
var Editkuang = hezikuang.add("edittext", undefined, 140);
var Lkuangun = hezikuang.add("statictext", undefined, "mm");
var hezigao = panelMargins.add("group");
var Lgao = hezigao.add("statictext", undefined, "盒子高度:");
var Editgao = hezigao.add("edittext", undefined, 30);
var Lgaoun = hezigao.add("statictext", undefined, "mm");
var baobian = panelMargins.add("group");
var Lbaobian = baobian.add("statictext", undefined, "包边宽度:");
var Editbaobian = baobian.add("edittext", undefined, 15);
var Lbaobian = baobian.add("statictext", undefined, "mm");
var panelLocation = win.add("panel", undefined, "盒型");
var yinghe = panelLocation.add("radiobutton", undefined, "硬盒");
var ruanhe = panelLocation.add("radiobutton", undefined, "软盒");
var btnOk = win.add("button", undefined, "Ok");
yinghe.value = true;
panelMargins.spacing = 10;
btnOk.onClick = function() {
if (Editchang.text != "" && Editkuang.text != "" && Editgao.text != "" && Editbaobian.text != "") {
if (yinghe.value == true) {
huahezi(Editchang.text, Editkuang.text, Editgao.text, Editbaobian.text);
} else {
huaruanhe(Editchang.text, Editkuang.text, Editgao.text, Editbaobian.text);
}
}
};
win.center();
win.show();
}

function huahezi(chang, kuang, gao, baobian) {
var docRef = app.activeDocument;
try {
var speclayer = docRef.layers.dieline;
} catch (err) {
var speclayer = docRef.layers.add();
speclayer.name = "dieline";
var artboardRef = docRef.artboards;
var width = UnitValue(Number(chang), "mm").as("pt");
var height = UnitValue(Number(kuang), "mm").as("pt");
var top = artboardRef[0].artboardRect[1];
var left = artboardRef[0].artboardRect[0];
var rect = speclayer.pathItems.rectangle(top, left, width, height);
hColor = new CMYKColor();
hColor.cyan = 0;
hColor.magenta = 0;
hColor.yellow = 0;
hColor.black = 100;
rect.strokeColor = hColor;
rect.fillColor = new NoColor();
var width = UnitValue(Number(gao), "mm").as("pt");
var height = UnitValue(Number(kuang), "mm").as("pt");
var top = artboardRef[0].artboardRect[1];
var left = artboardRef[0].artboardRect[0] - width;
var rect = speclayer.pathItems.rectangle(top, left, width, height);
rect.strokeColor = hColor;
rect.fillColor = new NoColor();
var gaibaobian = UnitValue(Number(baobian), "mm").as("pt");
var width = UnitValue(Number(gao), "mm").as("pt");
var height = UnitValue(Number(kuang), "mm").as("pt");
var top = artboardRef[0].artboardRect[1];
var left = (artboardRef[0].artboardRect[0] - width) - gaibaobian;
var rect = speclayer.pathItems.rectangle(top, left, gaibaobian, height);
rect.strokeColor = hColor;
rect.fillColor = new NoColor();
var width = UnitValue(Number(gao), "mm").as("pt");
var changdu = UnitValue(Number(chang), "mm").as("pt");
var height = UnitValue(Number(kuang), "mm").as("pt");
var top = artboardRef[0].artboardRect[1];
var left = artboardRef[0].artboardRect[0] + changdu;
var rect = speclayer.pathItems.rectangle(top, left, width, height);
rect.strokeColor = hColor;
rect.fillColor = new NoColor();
var width = UnitValue(Number(gao), "mm").as("pt");
var changdu = UnitValue(Number(chang), "mm").as("pt");
var height = UnitValue(Number(kuang), "mm").as("pt");
var top = artboardRef[0].artboardRect[1];
var left = artboardRef[0].artboardRect[0] + changdu + width;
var rect = speclayer.pathItems.rectangle(top, left, gaibaobian, height);
rect.strokeColor = hColor;
rect.fillColor = new NoColor();
var width = UnitValue(Number(gao), "mm").as("pt");
var changdu = UnitValue(Number(chang), "mm").as("pt");
var height = UnitValue(Number(kuang), "mm").as("pt");
var top = artboardRef[0].artboardRect[1] + width;
var left = artboardRef[0].artboardRect[0];
var rect = speclayer.pathItems.rectangle(top, left, changdu, width);
rect.strokeColor = hColor;
rect.fillColor = new NoColor();
var width = UnitValue(Number(gao), "mm").as("pt");
var changdu = UnitValue(Number(chang), "mm").as("pt");
var height = UnitValue(Number(kuang), "mm").as("pt");
var top = artboardRef[0].artboardRect[1] + width + gaibaobian;
var left = artboardRef[0].artboardRect[0];
var rect = speclayer.pathItems.rectangle(top, left, changdu, gaibaobian);
rect.strokeColor = hColor;
rect.fillColor = new NoColor();
var width = UnitValue(Number(gao), "mm").as("pt");
var changdu = UnitValue(Number(chang), "mm").as("pt");
var height = UnitValue(Number(kuang), "mm").as("pt");
var top = artboardRef[0].artboardRect[1] - height;
var left = artboardRef[0].artboardRect[0];
var rect = speclayer.pathItems.rectangle(top, left, changdu, width);
rect.strokeColor = hColor;
rect.fillColor = new NoColor();
var width = UnitValue(Number(gao), "mm").as("pt");
var changdu = UnitValue(Number(chang), "mm").as("pt");
var height = UnitValue(Number(kuang), "mm").as("pt");
var top = (artboardRef[0].artboardRect[1] - height) - width;
var left = artboardRef[0].artboardRect[0];
var rect = speclayer.pathItems.rectangle(top, left, changdu, gaibaobian);
rect.strokeColor = hColor;
rect.fillColor = new NoColor();
app.redraw();
}
}

function huaruanhe(chang, kuang, gao, baobian) {
var docRef = app.activeDocument;
try {
var speclayer = docRef.layers.dieline;
} catch (err) {
var speclayer = docRef.layers.add();
speclayer.name = "dieline";
var artboardRef = docRef.artboards;
var width = UnitValue(Number(chang), "mm").as("pt");
var height = UnitValue(Number(kuang), "mm").as("pt");
var top = artboardRef[0].artboardRect[1];
var left = artboardRef[0].artboardRect[0];
var rect = speclayer.pathItems.rectangle(top, left, width, height);
hColor = new CMYKColor();
hColor.cyan = 0;
hColor.magenta = 0;
hColor.yellow = 0;
hColor.black = 100;
rect.strokeColor = hColor;
rect.fillColor = new NoColor();
var width = UnitValue(Number(gao), "mm").as("pt");
var height = UnitValue(Number(kuang), "mm").as("pt");
var top = artboardRef[0].artboardRect[1];
var left = artboardRef[0].artboardRect[0] - (width * 2);
var rect = speclayer.pathItems.rectangle(top, left, width, height);
rect.strokeColor = hColor;
rect.fillColor = new NoColor();
var rect = speclayer.pathItems.rectangle(top, left + width, width, height);
rect.strokeColor = hColor;
rect.fillColor = new NoColor();
var gaibaobian = UnitValue(Number(baobian), "mm").as("pt");
var width = UnitValue(Number(gao), "mm").as("pt");
var height = UnitValue(Number(kuang), "mm").as("pt");
var top = artboardRef[0].artboardRect[1];
var left = (artboardRef[0].artboardRect[0] - (width * 2)) - gaibaobian;
var rect = speclayer.pathItems.rectangle(top, left, gaibaobian, height);
rect.strokeColor = hColor;
rect.fillColor = new NoColor();
var width = UnitValue(Number(gao), "mm").as("pt");
var changdu = UnitValue(Number(chang), "mm").as("pt");
var height = UnitValue(Number(kuang), "mm").as("pt");
var top = artboardRef[0].artboardRect[1];
var left = artboardRef[0].artboardRect[0] + changdu;
var rect = speclayer.pathItems.rectangle(top, left, width, height);
rect.strokeColor = hColor;
rect.fillColor = new NoColor();
var rect = speclayer.pathItems.rectangle(top, left + width, width, height);
rect.strokeColor = hColor;
rect.fillColor = new NoColor();
var width = UnitValue(Number(gao), "mm").as("pt");
var changdu = UnitValue(Number(chang), "mm").as("pt");
var height = UnitValue(Number(kuang), "mm").as("pt");
var top = artboardRef[0].artboardRect[1];
var left = artboardRef[0].artboardRect[0] + changdu + (width * 2);
var rect = speclayer.pathItems.rectangle(top, left, gaibaobian, height);
rect.strokeColor = hColor;
rect.fillColor = new NoColor();
var width = UnitValue(Number(gao), "mm").as("pt");
var changdu = UnitValue(Number(chang), "mm").as("pt");
var height = UnitValue(Number(kuang), "mm").as("pt");
var top = artboardRef[0].artboardRect[1] + (width * 2);
var left = artboardRef[0].artboardRect[0];
var rect = speclayer.pathItems.rectangle(top, left, changdu, width);
rect.strokeColor = hColor;
rect.fillColor = new NoColor();
var rect = speclayer.pathItems.rectangle(top - width, left, changdu, width);
rect.strokeColor = hColor;
rect.fillColor = new NoColor();
var width = UnitValue(Number(gao), "mm").as("pt");
var changdu = UnitValue(Number(chang), "mm").as("pt");
var height = UnitValue(Number(kuang), "mm").as("pt");
var top = artboardRef[0].artboardRect[1] + (width * 2) + gaibaobian;
var left = artboardRef[0].artboardRect[0];
var rect = speclayer.pathItems.rectangle(top, left, changdu, gaibaobian);
rect.strokeColor = hColor;
rect.fillColor = new NoColor();
var width = UnitValue(Number(gao), "mm").as("pt");
var changdu = UnitValue(Number(chang), "mm").as("pt");
var height = UnitValue(Number(kuang), "mm").as("pt");
var top = artboardRef[0].artboardRect[1] - height;
var left = artboardRef[0].artboardRect[0];
var rect = speclayer.pathItems.rectangle(top, left, changdu, width);
rect.strokeColor = hColor;
rect.fillColor = new NoColor();
var rect = speclayer.pathItems.rectangle(top - width, left, changdu, width);
rect.strokeColor = hColor;
rect.fillColor = new NoColor();
var width = UnitValue(Number(gao), "mm").as("pt");
var changdu = UnitValue(Number(chang), "mm").as("pt");
var height = UnitValue(Number(kuang), "mm").as("pt");
var top = (artboardRef[0].artboardRect[1] - height) - (width * 2);
var left = artboardRef[0].artboardRect[0];
var rect = speclayer.pathItems.rectangle(top, left, changdu, gaibaobian);
rect.strokeColor = hColor;
rect.fillColor = new NoColor();
app.redraw();
}
}
Attached Images
File Type: jpg QQ截图20230427132619.jpg (12.2 KB, 7 views)
zhizun99 is offline  
Post New Thread Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


律师声明:本站内容,均具有版权,未经书面授权,禁止转载,严禁镜像,违者承担一切后果!
论坛广告报价   广告联系及办理企业会员服务QQ:57880388 站务管理QQ:35529388


All times are GMT +8. The time now is 2024-07-24 03:46.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
 
Copyright © 2004-2022