This content has been marked as final. Show 10 replies
Given a text frame myFrame, you change its number of columns to 2 using
myFrame.textFramePreferences.textColumnCount = 2;
So just cycle through all your text frames applying that one-liner to them.
Thanks, Peter. I will give that a try.
You can do this without a script a story at a time using FindObject. Select all the text of the story and then make changes to the text frame preferences for all the found objects.
The terminology here rubs the wrong way -- in scripts, we have to use textContainers but in FindObject they still speak of text frames but they mean the containers.
Since it is one long story, this works perfectly. Never knew you could do that. Thanks!
I should have realised by now that Find/Change object exists...
So I am aware that I can simply change the columns using Find/Change object, which I will use if I cannot figure how to script this (which I would prefer to do).
I have attempted to modify my usual Find/Change script; using the DOM, I figured that "textColummCount" would be exactly what I am looking for. However, the following does not seem to work:
app.findObjectPreferences.textColumnCount = 1;
app.changeObjectPreferences.textColumnCount = 2;
Seemed easy enough in theory, but when I run this and open the Find Object GUI, it is blank, which means that I am not communicating with INDD. Any ideas?
Follow up: I have tried Peter's initial suggestion. It works just as he says, and, just as he says, I need to cycle through each of my text frames (currently, of course, it only changes the first to double-column). I am going to work on the cycling through stuff; maybe that will be easier than trying to communicate with the Find/Change Object? If/when I figure all of this out, I will post my results, in case others have this same need in the future.
You're right, setting the preferences in find/changeObject doesn't seem to be doing very much. Doesn't look very healthy.
As to cycling through your text frames, it could be as easy as this:
tf = app.activeDocument.textFrames;
for (i = 0; i < tf.length; i++)
tf[i].textFramePreferences.textColumnCount = 2;
It depends on whether all text frames in your document need to get two columns. If not, you need to figure out how to exclude the frames that the script has to skip.
That works perfectly. Thanks so much! I was trying to write a function, call a function, etc., and I was just getting into all kinds of mess. I really appreciate you, Dave, and the rest of the experts on here who take time to help folks like me who are relatively new to the scripting experience.