これはイラストレーターのextendscriptですが、基本的にはjavascriptです。2番目のポップアップを1回だけ表示したいので、変数がすでに存在するかどうかを伝えて、入力を求めないようにしました。私が間違っていることについて何か考えはありますか?
#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");
}
}
}