文章目录
1.算法程序
- 1.算法程序
- 2.文本转执行
- 3.作者答疑
illustrator是矢量编辑软件,画板是绘制处理的重要容器,在印刷方面的一个重要功能就是裁切标记,开发一个裁切标记功能,源代码如下所示:
if (app.documents.length == 0) {
alert("请先建立一个新文件", "错误");
var myDoc = app.documents.add();
}
luRes = "dialog {alignChildren: 'fill', text: '裁切标记',margins:[8,8,8,8]\nall: Group { orientation: 'row',alignChildren: 'fill', \n myType: Panel {text:'类型',alignChildren: 'right',orientation: 'column',bounds:[100,0,225,110],properties:{borderStyle:'sunken'},\n lineType: Group { orientation: 'row', spacing:1,\n st: StaticText { text:'角线:' }, \n ddl: DropDownList {preferredSize: [54, 20] ,fontsize:3,properties:{items:['日式', '罗马','中式']}},\n } \n crossType: Group { orientation: 'row', spacing:1,\n cb: Checkbox { text:'套准', value: true}, \n ddl: DropDownList {preferredSize: [54, 20],properties:{items:['带圆', '无圆']}},\n } \n } \n mySize: Panel {text:'角线设置',alignChildren: 'fill',orientation: 'column',bounds:[100,0,240,0],properties:{borderStyle:'sunken'},\n lineLen: Group { orientation: 'row', \n s: StaticText { text:'长度:' }, \n e: EditText {text: 6 , preferredSize: [36, 20],active:true}, \n s: StaticText { text:'毫米' }, \n } \n lineBleed: Group { orientation: 'row', \n s: StaticText { text:'出血:' }, \n e: EditText { text:3, preferredSize: [36, 20] },\n s: StaticText { text:'毫米' }, \n } \n lineStroke: Group { orientation: 'row', \n s: StaticText { text:'描边:' }, \n e: EditText { text:0.25, preferredSize: [36, 20] },\n s: StaticText { text:'点' }, \n } \n } \n } \nall2: Group { orientation: 'row',alignChildren: 'fill',\n checkboxes: Panel { text:'选项', orientation:'column', alignChildren:'left',properties:{borderStyle:'black'},\n cb1: Checkbox { text:'添加角线图层 ', value: true}, \n cb2: Checkbox { text:'添加色标名称', value: true}, \n cb3: Checkbox { text:'添加文档信息' , value: true}, \n cb6: Checkbox { text:'包含对象边宽' }, \n cb4: Checkbox { text:'添加色条框', value: true}, \n cb5: Checkbox { text:'色条框线',alignment: 'center', value: true}, \n }\n myBisector: Panel { text:'等分线',alignChildren: 'left',orientation: 'column',bounds:[100,0,240,0],properties:{borderStyle:'sunken'},\n cb: Checkbox {text:'使用', value: true}\n myUse: Group { orientation: 'column',alignChildren: 'fill',\n myHor: Group { orientation: 'row', \n s: StaticText { text:'水平数:' }, \n e: EditText { text:2, preferredSize: [55, 20]}, } \n myHor2: Group { orientation: 'row', \n s3: StaticText { text:'切线距:' }, \n e2: EditText { text:6, preferredSize: [25, 20]},\n s4: StaticText { text:'毫米' }, \n } \n myVer: Group { orientation: 'row', \n s: StaticText {text:'垂直数:' }, \n e: EditText { text:4, preferredSize: [55, 20] }, } \n myVer2: Group { orientation: 'row', \n s3: StaticText { text:'切线距:' }, \n e2: EditText { text:6, preferredSize: [25, 20]},\n s4: StaticText { text:'毫米' }, \n } \n }\n }\n }\nbuttonGroups: Group { orientation: 'row', alignment: 'center', \ncancelBtn: Button { text:'取消',properties:{name:'cancel'}}, \nokBtn: Button { text:'确定',properties:{name:'ok'}}, \n }\n}";
var win = new Window(luRes);
win.all.myType.lineType.ddl.selection = win.all.myType.lineType.ddl.items[0];
win.all.myType.crossType.ddl.selection = win.all.myType.crossType.ddl.items[0];
selLine = win.all.myType.lineType.ddl.items[0];
selLine1 = win.all.myType.lineType.ddl.items[1];
selellipse = win.all.myType.crossType.ddl.items[0];
win.all.myType.crossType.cb.onClick = function() {
win.all.myType.crossType.ddl.enabled = this.value;
};
win.all2.myBisector.cb.onClick = function() {
win.all2.myBisector.myUse.enabled = this.value;
};
if (win.all2.myBisector.cb.value == true) {
win.all2.myBisector.cb.notify()
}
win.all2.checkboxes.cb4.onClick = function() {
win.all2.checkboxes.cb5.enabled = this.value;
};
win.center();
myReturn = win.show();
if (myReturn == true) {
var docRef = app.activeDocument;
var pointTomm = 2.83464566929134;
var pw = 0;
var ph = 0;
var x = 0;
var y = 0;
var aiver = app.version;
var fileNameLocation = 0;
var pageNumberLocation = 0;
var mCMYK = [setCMYKcolor(100, 0, 0, 0), setCMYKcolor(0, 100, 0, 0), setCMYKcolor(0, 0, 100, 0), setCMYKcolor(0, 0, 0, 100)];
mCMYK.push(setCMYKcolor(100, 100, 0, 0), setCMYKcolor(100, 0, 100, 0), setCMYKcolor(0, 100, 100, 0), setCMYKcolor(0, 0, 0, 50));
var colorBarSize = 5 * pointTomm;
var regRoundSize = 3.6 * pointTomm;
var myFont = textFonts.getByName("MicrosoftYaHei");
var myFontSize = 9;
var lineLen = eval(win.all.mySize.lineLen.e.text) * pointTomm;
var lineBleed = eval(win.all.mySize.lineBleed.e.text) * pointTomm;
var hBisector = eval(win.all2.myBisector.myUse.myHor.e.text);
var vBisector = eval(win.all2.myBisector.myUse.myVer.e.text);
var hBSpace = eval(win.all2.myBisector.myUse.myHor2.e2.text) * pointTomm;
var vBSpace = eval(win.all2.myBisector.myUse.myVer2.e2.text) * pointTomm;
var SW = eval(win.all.mySize.lineStroke.e.text);
placeCropline = true;
win.all2.checkboxes.cb1.value ? creatCropMarkLayer = true : creatCropMarkLayer = false;
win.all2.myBisector.cb.value ? placeBisector = true : placeBisector = false;
win.all2.checkboxes.cb2.value ? placeColorName = true : placeColorName = false;
win.all2.checkboxes.cb3.value ? placeFileDateName = placePageSize = true : placeFileDateName = placePageSize = false;
win.all.myType.crossType.cb.value ? placeRegMark = true : placeRegMark = false;
win.all2.checkboxes.cb4.value ? placeColorBar = true : placeColorBar = false;
win.all2.checkboxes.cb5.value ? colorBarStroked = true : colorBarStroked = false;
if (lineLen = 49) {
alert("注意:页面数量超过 50 时需要较多的内存与较长的运行时间,请耐心等候。\n当出现 \"PARM\"错误时,请关掉一些不用的软件以释放可用内存!", "提示");
}
for (var j = 0; j
关注
打赏
最近更新
- 深拷贝和浅拷贝的区别(重点)
- 【Vue】走进Vue框架世界
- 【云服务器】项目部署—搭建网站—vue电商后台管理系统
- 【React介绍】 一文带你深入React
- 【React】React组件实例的三大属性之state,props,refs(你学废了吗)
- 【脚手架VueCLI】从零开始,创建一个VUE项目
- 【React】深入理解React组件生命周期----图文详解(含代码)
- 【React】DOM的Diffing算法是什么?以及DOM中key的作用----经典面试题
- 【React】1_使用React脚手架创建项目步骤--------详解(含项目结构说明)
- 【React】2_如何使用react脚手架写一个简单的页面?