<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:clearspace="http://www.jivesoftware.com/xmlns/jive/rss" version="2.0">
  <channel>
    <title>Adobe Community: Message List - Generate TOC with JavaScript</title>
    <link>https://forums.adobe.com/community/indesign/indesign_scripting?view=discussions</link>
    <description>Most recent forum messages</description>
    <language>en</language>
    <pubDate>Fri, 11 Oct 2013 21:44:04 GMT</pubDate>
    <generator>Jive Engage 7.0.0.1  (http://jivesoftware.com/products/)</generator>
    <dc:date>2013-10-11T21:44:04Z</dc:date>
    <dc:language>en</dc:language>
    <item>
      <title>Re: Generate TOC with JavaScript</title>
      <link>https://forums.adobe.com/message/5754158?tstart=0#5754158</link>
      <description>&lt;!-- [DocumentBodyStart:68ee8935-53fe-4f41-959f-bafc136782a0] --&gt;&lt;div class="jive-rendered-content"&gt;&lt;p&gt;Hi,&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;blockquote class="jive-quote"&gt;&lt;p&gt;&lt;span style="font-size: 14px;"&gt;1. I already have a text frame on page 2...&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;While creating TOC its textFrame is marked so TOC story could be updated easy. If you move a story - not a text Frame - this connection is broken. &lt;/p&gt;&lt;p&gt;None the less you can use a move method to a story as well. (see &lt;a class="jive-link-external-small" href="http://jongware.mit.edu/idcs5js/pc_Story.html#move" rel="nofollow"&gt;http://jongware.mit.edu/idcs5js/pc_Story.html#move&lt;/a&gt;)&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;blockquote class="jive-quote"&gt;&lt;p&gt; 2 ... the automatic reflow stops about three pages before the end of the document and gives me an overset text error....&lt;/p&gt;&lt;/blockquote&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Hard to say anything with no look at the code...&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Jarek &lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:68ee8935-53fe-4f41-959f-bafc136782a0] --&gt;&lt;img src='/beacon?t=1415905860623' /&gt;</description>
      <pubDate>Fri, 11 Oct 2013 21:44:04 GMT</pubDate>
      <author>forums_noreply@adobe.com</author>
      <guid>https://forums.adobe.com/message/5754158?tstart=0#5754158</guid>
      <dc:date>2013-10-11T21:44:04Z</dc:date>
      <clearspace:dateToText>1 year 1 month ago</clearspace:dateToText>
      <clearspace:objectType>0</clearspace:objectType>
    </item>
    <item>
      <title>Re: Generate TOC with JavaScript</title>
      <link>https://forums.adobe.com/message/5753913?tstart=0#5753913</link>
      <description>&lt;!-- [DocumentBodyStart:152dceee-c921-4bd2-9ec0-6460dff6ffec] --&gt;&lt;div class="jive-rendered-content"&gt;&lt;p&gt;Jarek,&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thank you for the helpful suggestion, which I tried. It works, but I have two questions:&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;1. I already have a text frame on page 2 that is set up for automatic reflow. If my TOC takes more than one page, how do I deal with that with the move technique? I would prefer to grab the story contents from the TOC and put them in the text frame on page 2. Is this possible?&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;2. The main body of the document ends up with 28 pages of connected text. When I omit the createTOC step, the document flows properly and I have no overset text. When I include the createTOC (whether I leave it on page 1 or move it to page 2), the automatic reflow stops about three pages before the end of the document and gives me an overset text error. The only code difference in these two scenarios is whether or not I comment out the createTOC statement. Any idea why it messes with the automatic reflow of the body text?&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Dan&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:152dceee-c921-4bd2-9ec0-6460dff6ffec] --&gt;</description>
      <pubDate>Fri, 11 Oct 2013 19:00:35 GMT</pubDate>
      <author>forums_noreply@adobe.com</author>
      <guid>https://forums.adobe.com/message/5753913?tstart=0#5753913</guid>
      <dc:date>2013-10-11T19:00:35Z</dc:date>
      <clearspace:dateToText>1 year 1 month ago</clearspace:dateToText>
      <clearspace:replyCount>1</clearspace:replyCount>
      <clearspace:objectType>0</clearspace:objectType>
    </item>
    <item>
      <title>Re: Generate TOC with JavaScript</title>
      <link>https://forums.adobe.com/message/5752545?tstart=0#5752545</link>
      <description>&lt;!-- [DocumentBodyStart:2dde2aab-d77a-4398-9b99-6ee5ae861d9c] --&gt;&lt;div class="jive-rendered-content"&gt;&lt;p&gt;Hi,&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Move its text container (this is array of stories):&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;!--[CodeBlockStart:6833a419-9948-4bc2-b6a8-a4d7f98d4b92][excluded]--&gt;&lt;pre class="java" name="code"&gt;//...
var 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; doc = app.activeDocument,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mTOC = doc.createTOC(doc.tocStyles.item("TOC"), true, null, ["1.0i", "1.0i"])[0].textContainers[0];

mTOC.move(doc.pages[1]); 
mTOC.move(["1.0i", "1.0i"]);
//...
&lt;/pre&gt;&lt;!--[CodeBlockEnd:6833a419-9948-4bc2-b6a8-a4d7f98d4b92]--&gt;&lt;div style="display:none;"&gt;&lt;/div&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Jarek&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:2dde2aab-d77a-4398-9b99-6ee5ae861d9c] --&gt;</description>
      <pubDate>Fri, 11 Oct 2013 07:41:15 GMT</pubDate>
      <author>forums_noreply@adobe.com</author>
      <guid>https://forums.adobe.com/message/5752545?tstart=0#5752545</guid>
      <dc:date>2013-10-11T07:41:15Z</dc:date>
      <clearspace:dateToText>1 year 1 month ago</clearspace:dateToText>
      <clearspace:replyCount>2</clearspace:replyCount>
      <clearspace:objectType>0</clearspace:objectType>
    </item>
    <item>
      <title>Generate TOC with JavaScript</title>
      <link>https://forums.adobe.com/message/5750921?tstart=0#5750921</link>
      <description>&lt;!-- [DocumentBodyStart:965d4482-8425-4b44-9400-6fe85f080505] --&gt;&lt;div class="jive-rendered-content"&gt;&lt;p&gt;I have a JavaScript script that opens an InDesign template and inserts text (including placing RTF files) on various pages throughout the template. Page 2 is empty, and I want to automatically generate a table of contents and place it on that page. When I use the following command, it always places it on page 1:&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;doc.createTOC(doc.tocStyles.item("TOC"), true, null, ["1.0i", "1.0i"]);&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;How do I get it on page 2? Thanks!&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:965d4482-8425-4b44-9400-6fe85f080505] --&gt;</description>
      <pubDate>Thu, 10 Oct 2013 16:07:15 GMT</pubDate>
      <author>forums_noreply@adobe.com</author>
      <guid>https://forums.adobe.com/message/5750921?tstart=0#5750921</guid>
      <dc:date>2013-10-10T16:07:15Z</dc:date>
      <clearspace:dateToText>1 year 1 month ago</clearspace:dateToText>
      <clearspace:replyCount>3</clearspace:replyCount>
      <clearspace:objectType>0</clearspace:objectType>
    </item>
  </channel>
</rss>

