我是平面设计师,编码初学者。所以请为我哑口无言:)
我有一个脚本,我运行了Illustrator。它嵌入图像并删除文件上的剪辑掩码。我需要这个脚本在一个文件夹中的多个.ai文件上运行。
问题是,我不能创建一个批处理操作(在Illustrator中)来运行脚本。我们的IT人员不想将脚本添加到多个帐户上的Illustrator设置中。有什么方法可以在我的脚本中添加代码来完成这个任务吗?
我需要它打开所有的文件,运行脚本并保存。文件可以打开在Illustrator上,不需要关闭。
我需要在我的脚本中添加哪些代码?
我用的是Mac,而不是PC。
发布于 2022-02-10 17:39:44
可以这样做:
function my_script() {
// copy a full text of your script here
// or include the jsx file this way:
# include '~/Desktop/script/my_script.jsx'
}
function main() {
var folder = Folder.selectDialog('Please, select the folder');
if (!(folder instanceof Folder)) return;
var files = folder.getFiles('*.ai');
if (files.length == 0) {
alert('Folder doesn\'t content AI files');
return;
}
var i = files.length;
while (i--) {
var doc = app.open(files[i]);
my_script(); // <------- here your script is running
doc.save();
doc.close();
}
alert(files.length + ' files were processed');
}
main();发布于 2022-11-28 11:25:59
如果您选择的文件夹中有带有.ai文件的子文件夹,并且需要在脚本中访问它们,您可能会发现这个JS片段也很有用:
https://stackoverflow.com/questions/71069458
复制相似问题