我想最终在我的服务器上创建一个文件夹,其中将填充图像,使用 basil.js 我想提取它们并将它们放入 indesign 中。
该脚本有效,但我需要一个 IF 语句,该语句将错误检查 URL 是否实际存在......因为目前即使该 URL 上没有实际图像,它也会放置一个黑色占位符。
if != url .....所以我不必使用 FOR 循环...我会继续添加图像,直到检查整个目录。
可能没有你如何做到这一点......对不起,但由于我是一个新手,我一直在修补它。
#includepath "~/Documents/;%USERPROFILE%Documents";
#include "basiljs/bundle/basil.js";
var count = 1;
var x = 100;
var y = 100;
function draw() {
for (i = 0; i < 15; i++) {
var url = "http://www.minceandcheesepie.com/spaceinvaders/image" + count + ".png";
var newFile = new File("~/Documents/basiljs/user/data/image" + count + ".png");
b.download(url, newFile);
b.image('image' + count +'.png', x, y);
x += 200;
y += 200;
count++;
app.select(NothingEnum.nothing, undefined);
}
}
b.go();