QQ登录

只需一步,快速开始

查看: 3967|回复: 2
收起左侧

定咬口用, 单色机遮住色条

[复制链接]
累计签到:14 天
连续签到:1 天
发表于 2020-7-29 10:52:45 | 显示全部楼层 |阅读模式
var myDoc = app.activeDocument;
var pt=72/25.4;
[sell=2,2][/sell]

juli=prompt("755x625",6);
var 板材长=755;
var 板材高=625;
var 板材咬口=58-juli;
var h=0;
var pis = getPosition(myDoc.selection);
var regColor = getReg();


var w=10*pt;
var x=板材长*pt;
var y=板材高*pt;
var z=板材咬口*pt;
var tp="755";
for (i=0; i<myDoc.artboards.length; i++) {
var docRef = activeDocument;
var group1 = docRef.groupItems.add();
var textRef1 = group1.textFrames.add();
var abBounds = myDoc.artboards.artboardRect;
var 宽=(abBounds[2]-abBounds[0]);
var 高=(abBounds[1]-abBounds[3]);
var a=(x-宽)/2;
var myDate = new Date();
var month=myDate.getMonth()+1;
var p=myDoc.artboards.length;
var k=i+1
if(p==1){
var str1=activeDocument.name;
}else{
if(i % 2 ==0){
var j=parseInt((i+1)/2.1+1);
var str1="【第"+j+"套 正面】"+"【"+p+"-"+k+"】"+activeDocument.name;
}
if(i % 2 ==1){
var j=parseInt((i+1)/2.1+1);
var str1="【第"+j+"套 反面】"+"【"+p+"-"+k+"】"+activeDocument.name;
}
}
//alert(h/pt)
var b=y-高-z;
myDoc.artboards.artboardRect = [abBounds[0]-a-h, abBounds[1]+b, abBounds[2]+a-h, abBounds[3]-z];
var thedate = new Date()
today = thedate.getFullYear() + '-' + (thedate.getMonth()+1) + '-' + thedate.getDate() //2016-3-5 15:01:08
//文字部分


textRef1.left=abBounds[0]-a+5*pt;//距离左边的距离
textRef1.top =w+abBounds[3]-z+textRef1.height; //距离顶边的距离
var thedate = new Date()
today = thedate.getFullYear() + '年' + (thedate.getMonth()+1) + '月' + thedate.getDate()+'日'+thedate.getHours ()+'时'+thedate.getMinutes()+'分' //2016-3-5 15:01:08
textRef1.contents =today+" "+tp+str1;
textRef1.textRange.characterAttributes.size=15; //**********字体大小
textRef1.textRange.characterAttributes.underline =false; //下划线
textRef1.textRange.characterAttributes.textFont = textFonts.getByName("MicrosoftYaHei");
textRef1.textRange.characterAttributes.fillColor = regColor;//填充颜色
textRef1.createOutline();//是否转曲
}



for (i=0; i<myDoc.artboards.length; i++) {
var abBounds = myDoc.artboards.artboardRect;
if(myDoc.selection.length>0){
var rect = myDoc.pathItems.rectangle(pis.top,pis.left+12*pt,abBounds[2]-abBounds[0],3*pt);

var white = new CMYKColor();//创建颜色变量
redColor.cyan= 0;//设置颜色的值
redColor.magenta = 0;//设置颜色的值
redColor.yellow = 0;//设置颜色的值
redColor.black = 0;//设置颜色的值
rect.strokeColor=NoColor;
rect.fillColor= white;//标线使用套版色
}
}



function getPosition(sels){
var tempTop = sels[0].top;
for(n = 1;n<sels.length;n++){
if(tempTop<sels[n].top){
tempTop=sels[n].top;
}
}
var tempLeft = sels[0].left;
for(n = 1;n<sels.length;n++){
if(tempLeft>sels[n].left){
tempLeft=sels[n].left;
}
}
var p = {
top:tempTop,
left:tempLeft
};
return p;
}
app.executeMenuCommand("copy");
app.executeMenuCommand("pasteInPlace");

/**获取套版色*/
function getReg(){
for (i=0;i<activeDocument.spots.length;i++){
var newSpot1 = activeDocument.spots; //获得套版色
var s = newSpot1.toString();

aa= s.indexOf('套');
bb= s.indexOf('Registration');

if ( bb !=-1){
var newSpot = activeDocument.spots; //获得套版色
i=activeDocument.spots.length
}
if (aa !=-1 ){
var newSpot = activeDocument.spots; //获得套版色
i=activeDocument.spots.length
}

}

var regColor = new SpotColor();
regColor.spot = newSpot;
return regColor;

}

华印网相关搜索

累计签到:1003 天
连续签到:1 天
发表于 2020-7-29 11:29:28 | 显示全部楼层
用不了,不知道是不是我不会用。
回复 支持 反对 送花

使用道具 举报

累计签到:608 天
连续签到:1 天
发表于 2020-7-29 13:49:43 | 显示全部楼层
报错:语法错误
回复 支持 反对 送花

使用道具 举报

您需要登录后才可以回帖 登录 | 注册帐号

本版积分规则

关闭

注意注意注意:必看上一条 /1 下一条

华印网 - 华印社区
Share More 周一至周日:09:00 - 21:00
华印网旗下的设计印刷制作类专业技术站点
请勿发布违反国家法律法规的内容,会员观点不代表本站立场
企鹅群号:119572101

华印网汇集印前印后技术、PDF拼版、防伪包装、数码印刷、合版印刷、图文设计、平面设计、数码印刷及CTP等最新印刷技术,提供软件汉化、插件汉化、cdr插件、ai插件、ps插件、pdf插件、印刷流程、ctp输出、印刷软件、印能捷、esko、CorelDRAW、InDesign、Illustrator、CTP、CDR以及PDF软件下载的综合性印刷论坛社区!

Powered by Discuz! X3.4 © 2001-2021,Tencent Cloud.

站点地图|小黑屋|手机版|Archiver|华印 ( 粤ICP备19020152号-1 )

GMT+8, 2024-4-26 16:35 , Processed in 0.026262 second(s), 20 queries , Gzip On, Yac On.

快速回复 返回顶部 返回列表