Creating a TOC with Scripter
While working on some documentation for generating a TOC in something of an automatic way with Scribus, it seemed to me that this seems rather complex, and I wondered if there might be a better way to do this with Scripter.
I had already written a script that could analyze the content of a document and extract text and filenames of the images in the file, page by page. What follows is a modification of that script for creating a table of contents.
To use this script, although it's not a requirement, it is useful to rename the frames to something useful in a TOC. One problem with this is that you will find that, at least when you edit the frame name, you cannot have spaces, so instead of First Article we'll use First_Article, substituting an underline for the space – don't worry, we take care of that in the script.