Hi Beth,
thank you for your test document.
There is one textBox form field directly on the page and four others are anchored.
My initial script code is working as expected on the one that is not anchored. For me no need to run script code two times.
Here the code again:
app.documents[0].textBoxes.everyItem().properties =
{
appliedFont : "Arial" ,
fontStyle : "Italic" ,
fontSize : 0
};
Well, you are working on Mac OS X, I have InDesign installed on Windows 10. And we are using slightly different versions of the same main version. Could make a difference, but shouldn't in this case. You already debugged the code and you do not run fontStyle when you first apply the object to the properties, but obviously you need to apply the fontStyle property separately to make it work. On my Windows system it is working in one go.
However, for the anchored textBox objects we need a different approach.
As I already suggested:
You could loop the allPageItems array of the document, filter out the textBox objects and apply the properties.
Tested OK with your document:
var doc = app.documents[0];
var allPageItemsArray = doc.allPageItems;
var allPageItemsArrayLength = allPageItemsArray.length;
var newProperties =
{
appliedFont : "Arial" ,
fontStyle : "Italic" ,
fontSize : 0
};
for( var n=0; n<allPageItemsArrayLength; n++ )
{
// Do nothing, if the current page item is NOT a text box form field:
if( allPageItemsArray[n].constructor.name != "TextBox" ){ continue };
allPageItemsArray[n].properties = newProperties ;
};
// Done
alert( "Text Box Form Fields changed!" );
Regards,
Uwe Laubender
( ACP )