吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

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

[其他求助] 帮忙改下Adobe Illustrator脚本单位

[复制链接]
aoni 发表于 2024-6-18 08:54
50吾爱币
帮忙把以下Adobe Illustrator扩边脚本单位改成mm,谢谢

if( app.documents.length == 0 ) {
        fileToProcess = File.openDialog();
        app.open(fileToProcess);
}
var daopt = 2.834645;
var myBorder = -1;
var myBorderInput = -1;
while (myBorder < 0 || myBorder > 100 || isNaN(myBorder) ) {
        myBorderInput = prompt("输入扩边距离,单位: pt","20");
        myBorder = parseInt(myBorderInput);
}


var doc = app.activeDocument;

var myVisibleBounds = doc.visibleBounds;

myVisibleBounds[0] -= myBorder;
myVisibleBounds[1] += myBorder;
myVisibleBounds[2] += myBorder;
myVisibleBounds[3] -= myBorder;

doc.artboards[0].artboardRect = myVisibleBounds;

最佳答案

查看完整内容

改了myBorderInput * daopt,没有测试,不知道行不行 [mw_shl_code=javascript,true]if( app.documents.length == 0 ) { fileToProcess = File.openDialog(); app.open(fileToProcess); } var daopt = 2.834645; var myBorder = -1; var myBorderInput = -1; while (myBorder < 0 || myBorder > 100 || isNaN(myBorder) ) { myBorderInput = prompt("输入扩边距离,单位: mm","7"); ...

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

cqfcy 发表于 2024-6-18 08:54
改了myBorderInput * daopt,没有测试,不知道行不行
[JavaScript] 纯文本查看 复制代码
if( app.documents.length == 0 ) {        fileToProcess = File.openDialog();
        app.open(fileToProcess);
}
var daopt = 2.834645;
var myBorder = -1;
var myBorderInput = -1;
while (myBorder < 0 || myBorder > 100 || isNaN(myBorder) ) {
        myBorderInput = prompt("输入扩边距离,单位: mm","7");
        // mm转pt
        myBorder = parseInt(myBorderInput * daopt);
}

var doc = app.activeDocument;

var myVisibleBounds = doc.visibleBounds;

myVisibleBounds[0] -= myBorder;
myVisibleBounds[1] += myBorder;
myVisibleBounds[2] += myBorder;
myVisibleBounds[3] -= myBorder;

doc.artboards[0].artboardRect = myVisibleBounds;
 楼主| aoni 发表于 2024-6-18 09:34
cqfcy 发表于 2024-6-18 09:14
改了myBorderInput * daopt,没有测试,不知道行不行
[mw_shl_code=javascript,true]if( app.d ...

可以可以了。哈哈哈哈~~
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-12-11 18:47

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

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