0
這是illustrator的擴展,它基本上是JavaScript。我想第二個彈出窗口只顯示一次,我試圖告訴它,如果變量已經存在不做,但如果它不要求輸入。任何想法我做錯了什麼?簡單的JavaScript循環
#target illustrator
if (app.documents.length > 0) {
var replaceThis = prompt('What font do you want to replace?','')
for (i = 0; i< app.activeDocument.textFrames.length; i++) { //loop through the layers
var textArtRange = app.activeDocument.textFrames[i].textRange;
var fontSize = textArtRange.characterAttributes.size;
//var replaceThis = "10";
//alert("replace this:" + replaceThis);
// alert("current font size" + fontSize);
if (fontSize == replaceThis) {
Replacefont();
}
function Replacefont() {
//var newSize = "90";
if (!newSize) {
var newSize = prompt('Replace '+ replaceThis +'pt with:','')
}
textArtRange.characterAttributes.size = newSize;
alert("yay");
}
}
}