Indesign script ignores text wrap offset

Hi there

I have a script that toggles text wrap on/off. It has worked like a charm in CS3, but fails to work properly in Indesign CS5. It works sort of, but it ignores the text wrap offset defined in the script (text wrap offset: {3.5, 3.5, 3.5, 3.5}). It just toggles the wrap on to the default values associated with the object (in my case {0, 0, 0, 0}).

Does anyone have a clue what to do?


tell application "Adobe InDesign CS5"
	set theSel to a reference to selection
	set theWrap to text wrap preferences of theSel
	set TextWrap to text wrap mode of theWrap
	if TextWrap is none then
		set properties of theWrap to {text wrap mode:bounding box text wrap, text wrap offset:{3.5, 3.5, 3.5, 3.5}}
		set properties of theWrap to {text wrap mode:none}
	end if
end tell

Model: imac 27"
Browser: Safari 533.21.1
Operating System: Mac OS X (10.6)

This breaks with the established method of setting properties in previous versions and is wonky, but it seems to now only work when the wrap styling is completed after setting the mode. The dictionary entry for text wrap offset is also truncated. You should file a bug report:

Guess Marc’s right,

here’s the code from scripting tutorial ID CS5:

--Apply a text wrap to the graphic frame.
set text wrap mode of text wrap preferences of myFrame to bounding box text wrap
set text wrap offset of text wrap preferences of myFrame to {24, 12, 24, 12}

It works! Thanks!

Next time I’ll promise to read the scripting guide before posting. I keep forgetting it exists.