@Colin – don't know, if I have time to look into this more deeply today or the next days.
Just looked at your if statement:
You have to eliminate the quotes from TextWrapModes.NONE.
TextWrapModes.NONE is no String Object. It's an Enumeration Object. If you wrap it in quotes like that: "TextWrapModes.NONE", ExtendScript will not recoginise it as an Enumerator.
An Enumeration is a fixed feature baked in the DOM of InDesign.
Instead of TextWrapModes.NONE you could also use it's number representation.
In your case that would be the number: 1852796517
So:
wrap === TextWrapModes.NONE
would be basically the same as:
wrap === 1852796517
You could look up all enumerations here (better use the chm-file representatons):
http://www.jongware.com/idjshelp.html
Or directly here (but it's more trouble to run a find action for a specific phrase or DOM object):
http://jongware.mit.edu/idcs6js/
Your specific case is here:
http://jongware.mit.edu/idcs6js/pe_TextWrapModes.html
Uwe