1

I am writing a script for Indesign. In that script I am taking the contents of the text frames and save them to a database. Till here my script works. However when looping between text frames script uses creation order. I want to save to database in question order.

Here is my script:

var myDocument = app.activeDocument;var frameList = myDocument.textFrames;
for (var i = 0; i < frameList.length; i++){ 
    var txt=frameList[i].contents;
    SaveToDB(txt);
}

So is there a way to change creation order of textframes

Indesign I'm working with

  • The only way to 'change' creation order is to delete all text frames and then re-create them in the correct order. Consider using the question number in the frame instead. – usr2564301 Feb 20 '15 at 11:20
0

Yes, there is a way to change the "creation order", you simply need to rearrange the text frames in the Layers panel. The text frame at the lowest position in the stack will be treated as if it were created first, and the one at the highest position as if it were created last.

However, I know of no way to change this stack order via script (if somebody knows one, I would be curious to hear it).

So your choices are to either manually rearranging this stack order in the Layers panel and then run your script or to do what Jongware said, to sort it by the question numbers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.