Export list of frames and page numbers

Here is a simple script to generate a text file with a list of all the frames, page by page. This was done with the idea of helping to create the raw material for a Table of Contents, since apparently there are occasionally some problems with the built-in function.

The only requirements for the script is that you have a document open. There is a fileDialog that asks for the name of the file you want to save the results to. You get a message saying it was successful. It wouldn't be so much work to alternatively (or in addition) load the text into a selected text frame that you created for the TOC.

Here is a small example of what you get. As you see this goes page by page. While it may look like the script looks for image frames first, it actually takes frames in the order they were created. The other thing I have done here is created a TOC Paragraph Style and applied it afterward.