Graphic Frame Text Wrap in Find/Change Object
I'm running InDesign 12.0.0.1 (2017) on mac OS 10.12.6 (Sierra). I was originally trying to write a script to automate changing text wrapping on all graphic frames in the active document to wrap to the largest area (TextWrapSideOptions.LARGEST_AREA). When I couldn't get a script that should have worked to function properly, I decided to try automating Find/Change Object queries. That's when I discovered that the manual queries weren't function. Allow me to elaborate:
Here's what I want to do:
Change the "Wrap Options > Wrap To" setting (TextWrapSideOption) for all graphic frames to "Largest Area" (TextWrapSideOptions.LARGESTAREA). This should really only have to apply to those graphic frames set to "Wrap around bounding box" (TextWrapModes.BOUNDINGBOXTEXTWRAP) and "Wrap to contour" (TextWrapModes.CONTOUR).
Here's the problem:
It only works if the graphic frame is set to "Wrap to contour." If the graphic frame is set to "Wrap to bounding box," then it either reports "Cannot find match," or it purports to have found the objects and have changed them, but does not actually change their text wrap modes. I've tried specifying the "Wrap to..." setting in the Find/Change query and many other setting (which are all unnecessary, if the graphic frame is set to "Wrap to contour"), and nothing works.
I've scoured the internet, and even my not-inconsiderable Google fu has turned up nothing on this problem. I have, however, reproduced it on several machines in my office. For your reference, I've included a set of screenshots from various simple queries and their results. With the help of an expert, here's the script I developed that should have done the trick:
var doc = app.documents[0];
var allGraphics = doc.allGraphics;
var allGraphicsLength = allGraphics.length;
for ( n=0; n<allGraphicsLength; n++)
{
allGraphics[n].textWrapPreferences.properties =
{
textWrapSide : TextWrapSideOptions.LARGEST_AREA ,
applyToMasterPageOnly : false
};
};