这是插画家的扩展脚本,但它基本上是 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");
}
}
}