- 精华
- 活跃值
-
- 积分
- 337
- 违规
-
- 印币
-
- 鲜花值
-
- 在线时间
- 小时
累计签到:14 天 连续签到:1 天
|
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;
}
|
|