Creating a TOC via script on InDesign Server [CS5.5]

I have been struggling for about two weeks with trying to figure out how to script the creation of a TOC and an index for a book.  I've successfully created the book, and have also been able to create the table of contents, however I cannot place the contents in the book.  From the UI it's simple because it loads up the cursor with the TOC contents.  But in script, it simply provides an array with a single Story object.
I have no idea how to make the story appear in my document.  Here's my current code:
var book = app.open("book.indb");
var doc = app.open("table_of_contents.indd");
var tocStyle = doc.tocStyles.firstItem();
var stories = doc.createTOC(tocStyle, true, book, ["1in", "1in"], false, doc.layers.firstItem());
When I hit that final line, I get the following error:
Invalid value for parameter 'destinationLayer' of method 'createTOC'. Expected Layer, but received Layer.
Okay... so, if it's expecting a Layer and I'm providing a Layer - what gives?
Originally I had figured that I:
Had to create a TOC document from a template which contains a single text frame that automatically flows from page-to-page (using a master)
Add the document to the book at the beginning
Copy the contents of the Story into the TextFrame
Iterate the Lines collection of the Story, copying the paragraph and character styles for each line
This works, but it's no longer a TOCStory type.  I would like to maintain the TOCStory type and just have the content flowed into the new document which I add.  This makes sense, logically, but I know that nothing in InDesign is really that logical.  It seems to be a lot of collection manipulations, but I cannot figure out which collections to manipulate.
The Index.generate() method seems so much more logical because the first argument is where to place the content.  If it were only that simple for the TOC!  If you've had experience doing this, please let me in on the secret...  I don't have access to the menu items so I cannot invoke actions.  Those threads don't seem to apply for InDesign Server (and that makes sense, since it's headless)
Thanks,
- Brett

Hi Brett,
here is the code that worked for me.
Michael
var bk=app.books.add(File("C:/Users/wwadmin/Desktop/testbook.indb"));
for(i=0; i<5; i++){
var doc=app.documents.add()
var page=doc.pages.firstItem()
var frame=page.textFrames.add({geometricBounds:[0,0,'10in','10in']})
frame.contents="Hello World!!!!!";
var style=doc.paragraphStyles.add({name:"Body"});
frame.paragraphs.firstItem().appliedParagraphStyle=style;
doc.save(new File("C:/Users/wwadmin/Desktop/doc"+i+".indd"))
bk.bookContents.add(File("C:/Users/wwadmin/Desktop/doc"+i+".indd"));
var doc=app.documents.add();
var page=doc.pages.firstItem();
style=doc.paragraphStyles.add({name:"Body"})
tocstyle=doc.tocStyles.add({name:"myStyle"});
tocstyle.tocStyleEntries.add({formatStyle:style, name:style.name});
doc.save(new File("C:/Users/wwadmin/Desktop/test.indd"))
bk.bookContents.add(File("C:/Users/wwadmin/Desktop/test.indd"));
doc.createTOC(tocstyle, true, bk, undefined, true, doc.layers.firstItem())
bk.save()
for(a=app.documents.length-1; a>(-1); a--){
app.documents[a].save(File(app.documents[a].fullName));
app.documents[a].close();
bk.close()

Similar Messages

  • Visual Studio compiling 64 Bit Plugin for InDesign Server CS5

    Hello guys,
    Again I have a problem compiling 64 bit plugins, but this time in windows environments, the 32 bit compiling works fine (also on 64 bit machines). The first thing I've done was creating a new project configuration for 64 bit environments copying the 32 bit settings. Now I changed the precompiled libraries to use the 64 bit ones and changed the output directories. After that the compilation process completed without errors, but the resource files have not been copied to the output directory (the directory for them has been created, but it remains empty). Adding the created plugin into the servers directory ends up with a server message that the plugin could not be recognized. Have I missed something that is necessary for compiling 64 bit plugins?
    I'm using the 64 Bit Developer Version of the indesign server CS5. The operating system is a Windows Server 2008 x64 R2 with Visual Studio 2008.
    Thanks!
    P.S. a plugin compiled with 32 bit settings (including 32 bit libraries) also works for the 64 bit version of the server, so does it make any difference if I'm using 32 bit or 64 bit libraries?

    The libraries were all correct (all using 64-bit).  The problem was a pathing issue.  libxml2 needs iconv.dll, but it couldn't find the 64-bit version that I built.  Once it found it, everything worked correctly.
    The funny thing about depends.exe is that it isn't right all the time.  For example, if you open one of the 64-bit .aip files that ships with Illustrator (rename it to .dll first), you'll see what I'm talking about.  It complains that you're mixing x86 and x64 CPU types, even though you're not.
    The program I used to discover my issue is Process Monitor (http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx).  I've been using it for years and love it.

  • Issue in setting Load balancing for Indesign Server CS5.5

    Hi All,
    I need to set up load balancing mechanism for Indesign Server CS5.5 on Windows Server 2008 R2(64 bit version).
    I have dutifully following all steps defined in "WORKING WITH LOAD BALANCING AND QUEUEING FOR ADOBE INDESIGN CS5 SERVER.pdf"
    After running Indesign server using batch file "startup-indesign-server-CORBA-4instances.bat" from "<ID_SDK>\samples\load-balancing-and-queuing-clients\indesignserver-startup-scripts", I get only one instance of Indesign Server running. How to run multiple instances of the INDD server ? Is running multiple instance has something to do with type of licensing ?
    Now I run Clover.cmd script, I get this screen. I have no idea why its not working. Please help. Please let me know, if the scenario is not clear and more information is required.
    Thnx,
    D

    This is the image after running clover.bat

  • Indesign Server CS5 crashes at launch

    Hi,
    Indesign Server 7.03 on OSX 10.5.8 Intel Xserve.
    When Indesign server CS5 is launched at boot (or with launchctl) it crashes with the following errror in the system log:
    Nov 20 13:32:00 ams1ps01 com.adobe.ids.launchd.8888[799]: /Applications/Adobe InDesign CS5 Server/InDesignServer: line 13:   801 Trace/BPT trap          "$installed_name" "$@"
    Nov 20 13:32:00 ams1ps01 com.apple.launchd[1] (com.adobe.ids.launchd.8888[799]): Exited with exit code: 133
    Nov 20 13:32:00 ams1ps01 com.apple.launchd[1] (com.adobe.ids.launchd.8888): Throttling respawn: Will start in 3 seconds
    Nov 20 13:32:03 ams1ps01 InDesignServer[806]: 3891612: (connectAndCheck) Untrusted apps are not allowed to connect to or launch Window Server before login.
    Nov 20 13:32:03 ams1ps01 com.adobe.ids.launchd.8888[804]: Sat Nov 20 13:32:03 ams1ps01 InDesignServer[806] <Warning>: 3891612: (connectAndCheck) Untrusted apps are not allowed to connect to or launch Window Server before login.
    Nov 20 13:32:03 ams1ps01 com.adobe.ids.launchd.8888[804]: ================================================================================
    Nov 20 13:32:03 ams1ps01 com.adobe.ids.launchd.8888[804]: .  InDesign CS5 Server Version 7.0
    Nov 20 13:32:03 ams1ps01 com.adobe.ids.launchd.8888[804]: .  Copyright 1999-2010 Adobe Systems Incorporated and its licensors.
    Nov 20 13:32:03 ams1ps01 com.adobe.ids.launchd.8888[804]: .  All rights reserved. See the other legal notices in the ReadMe.
    Nov 20 13:32:03 ams1ps01 com.adobe.ids.launchd.8888[804]: ================================================================================
    Nov 20 13:32:04 ams1ps01 InDesignServer[806]: _RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
    Nov 20 13:32:04 ams1ps01 com.adobe.ids.launchd.8888[804]: _RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
    Nov 20 13:32:05 ams1ps01 kernel[0]: unknown SIGSEGV code 0
    Nov 20 13:32:05: --- last message repeated 1 time ---
    Nov 20 13:32:05 ams1ps01 InDesignServer[806]: [soap] Servicing SOAP requests on port 8888 [8888]
    Nov 20 13:32:07 ams1ps01 InDesignServer[806]: An uncaught exception was raised
    Nov 20 13:32:07 ams1ps01 com.adobe.ids.launchd.8888[804]: 2010-11-20 13:32:07.705 InDesignServer[806:10b] An uncaught exception was raised
    Nov 20 13:32:07 ams1ps01 InDesignServer[806]: Error (1002) creating CGSWindow
    Nov 20 13:32:07 ams1ps01 com.adobe.ids.launchd.8888[804]: 2010-11-20 13:32:07.706 InDesignServer[806:10b] Error (1002) creating CGSWindow
    Nov 20 13:32:07 ams1ps01 InDesignServer[806]: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1002) creating CGSWindow'
    Nov 20 13:32:07 ams1ps01 com.adobe.ids.launchd.8888[804]: 2010-11-20 13:32:07.706 InDesignServer[806:10b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1002) creating CGSWindow'
    When launched while logged on, it launches ok.
    Here's the content of the plist file used to launch ID Server:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"
    <plist version="1.0"> <dict>
    <key>Label</key>
    <string>com.adobe.ids.launchd.8888</string>
    <key>OnDemand</key>
    <false/>
    <key>ProgramArguments</key>
    <array>
    <string>/Applications/Adobe InDesign CS5 Server/InDesignServer</string>
    <string>-port</string>
    <string>8888</string>
    <string>-LogToApplicationEventLog</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    </dict>
    </plist>
    Please advice.
    Regards,
    Jeroen Peters

    Hi,
         I'm having the same problem. Anybody kows how to do it?
    Thanks

  • InDesign Server CS5.5 installation issue

    I am developing solution using InDesign Servers via COM which is hosted on Windows Server 2008 R2. And I am experiencing problem utilizing CS 5.5 server:
    When InDesign Server CS5.5 is installed on Windows Server 2008  (64bit) its COM component is registered with following parameters: CLSID = {96D10A00-63E3-423e-A223-DFC4BEA21206}, ProgId =  InDesignServer.Application.CS5.
    The problem is that those are the same parameters that are used for InDesign Server CS5 COM component. And therefore I can't have CS5 and CS5.5 installed on the same server, which is required for solution I am deleloping.
    Has anyone experienced that problem or maybe know some workaround for it?
    Meanwhile, When InDesign Server CS5.5 is installed on Windows 7 (32bit) its COM component is registered with unique parameters: CLSID ={34701EBC-5975-411C-8A45-E78E0934AADD}  and ProgId = InDesignServer.Application.CS5.5

    Hi Alexey
    I'm having trouble doing exactly what you say you have done.
    I'm trying to run InDesign Server CS5 and InDesign Server CS5.5 on the same Windows 2008 r2 64bit installation. InDesign Servers are Single Instance.
    I am only allowed to run one InDesign Server at once - not both.
    Is this possible for you or any other in this forum?
    Thanks in advance,
    Ruvan

  • Getting the default font - possible? (default fonts problem in InDesign Server CS5)

    Is there a way to decide whether a font is used as "default font" for a document?
    Or a simple way to see whether a font is used at all?
    The actual problem is that InDesign server (CS5 ver. 7.0.3.533) returns the "default font" along with all other used fonts, when looping through the document.fonts collection. This becomes a problem when the default font is never used in the document, and is also not present. Then the (name of) the default font may also become meddled by a style that does not even exist for that very font.
    This is indicated as a problem in our application... as a missing font, just as the call to InDesign server reports back. But the font (with that style) doesn't even exist.
    Running the same script on an desktop InDesign CS5 (ver 7.0.4) the unused default font of the same document is not returned at all.
    Thanks,
    Andreas

    To get the default font, just check:
    app.activeDocument.textDefaults.appliedFont
    Obviously this didn't solve the problem, since InDesign server has made up a font name that is reported as missing... and it's not equal to the default font. So there is some lack of logic in my previous description.

  • Search for, edit, and delete XML tag (Adobe InDesign Server CS5)

    Hi all,
    I'm working with Indesign Server CS5 and JavaScript, though having some trouble coming up with a solution to a problem...
    I need to build a JS script (called through SOAP) that will enable me to search an InDesign file for a given XML tag.
    Upon finding the XML tag, if the 'action' variable is set to delete, it should delete the tag and its contents.
    If the action is set to edit, it should change the contents of the tag to some user-specified content.
    The primary caveat is that the XML tag is variable, as is the XML structure of the InDesign file.
    Here's what I have in mind, in pseudocode:
    function findXMLTag(tag, action) {
         app.searchForTag(tag);
         if (tagIsFound) {
              if (action == "delete") {
                   tag.delete;
              } else if (action == "edit") {
                   tag.contents = "Updated content";
    Any help would be greatly appreciated!
    Thanks,
    Ben Kay

    'searchForTag' can be implemented as a recursive function.
    Recursion is defined like this: I thought, "I'll just search this forum for 'recursion'." The first post I found was one of my own, suggesting that the poster should search the forum for 'recursion'.
    Here is an example: find the XML Element [<email>]
    And another: Remove xml element using JS[CS3] (read carefully, as the OP got stuck on how to successfully remove an element and continue)
    And one, using XML Rules -- which I'm totally unfamiliar with, but may work for you: Changing Values in XML tags

  • InDesign Server CS5.5 developer

    I am a business systems manager in Glous, UK and I am looking for a InDesign Server CS5.5 developer to work as a part time consultant.  I can offer good rates -- any takers?

    Hello Martin,
    We are India based company and we have expertise in Adobe InDesing. Please take a look at www.raykor.com
    Thanks,
    Vikram

  • Is there any way I can know what are the list of patches installed on Indesign Server CS5

    Hi All,
    Is there any way I can know what are the list of patches installed on Indesign Server CS5?
    Please let me know if the there is any command to do so.
    Thanks,
    Manjunath

    Is this link any help?
    http://www.btvision.bt.com/on-demand/?cat=filmclub
    It seems to give the film club info.
    If you sort the list by "ending" date, shoul should be able to find recently added ones.
    There are some useful help pages here, for BT Broadband customers only, on my personal website.
    BT Broadband customers - help with broadband, WiFi, networking, e-mail and phones.

  • InDesign Server CS5  and Hardware Configuration.

    Does any one know of InDesign Server is supported on Intel Xeon processor?
    We have a need to generate 100's of PDF that merges a Data and Images togther. Each outout PDF varies anywhere from 20 MB to 400 MB. Below is the server configuration we are planing to purchase..
    Six-Core Intel® Xeon® Processor X5670 (2.93GHz, 12M L3 Cache, 95  with 84 GB RAM.
    http://h10010.www1.hp.com/wwpc/us/en/sm/WF06a/15351-15351-3328412-241644-241475-4091412.ht ml?dnr=1
    Any one have any experience and any issues?

    Hi there,
    Yes we solved it. We had a background process in our app that was trying to send over a thumbnail generation script. This would peg the INDS server for up to 15 minutes of just doing nothing. You would see the script come across but nothing would return so it would hose. Ended up fixing the error in our application and INDS has been working like a dream.
    When we were running this we only were on a single-instance. We've now migrated to a multi-instance and throughput seems to be a lot faster now.

  • Indesign Server CS5 Multiple instance - Urgent, Please help!

    Hi,
    I am using a windows service to access the indesign server. The instance is created like below.
            Dim oType As Type = Type.GetTypeFromProgID("InDesignServer.Application")
            If oType IsNot Nothing Then
                     Return Activator.CreateInstance(oType)
            End If
    If already an instance is created by some other application, then my service is not able to create an instance. I get the following error from the COM
    "Retrieving the COM class factory for component with CLSID {96D10A00-63E3-423E-A223-DFC4BEA21206} failed due to the following error: 80080005."
    In some article i read that instance can be created by different port numbers and different configuration.
    Is there anyway in VB.net to create an instance like that and will it solve the multiple instance problem ?
    Regards,
    Karthik B

    The solution on that site looks pretty good in theory.
    What did you do to implement it?
    Did you return a forward page from your executeSynchro method which you overrode to implement it?

  • Problem with InDesign Server CS5

    Hi all,
    when i run from prompt (of Windows Server 2008) the command "InDesign Server.com -port 18383" the system respond "Adobe InDesign Server is not properly licensed and will now quit", until some days ago the InDesign Server work perfecly. What i do for that issue ? I try to run cthe command "InDesignServer.com -serilanumber xxxxxx" and the command "InDesignServer.exe -serilanumber xxxxxxx" but doesn't work (the system says me the same think "Adobe InDesign Server is not properly licensed etc etc"). What can i do ?
    Thank you in advance
    Luca

    If you are using CS6, you need to link the installation to an Adobe ID. The simplest way to do that is input the Adobe ID while you install, but you can use the tools (I forget off hand what they are called) to do that afterwards.

  • Indesign server cs5

    Bonjour, je suis pas trop connaisseur de indesign.
    j'ai besoin vraiment d'aide si un de vous connaisse comment l'installer
    et la configuration qu'il lui faut?
    merci

    Hi,
         I'm having the same problem. Anybody kows how to do it?
    Thanks

  • Why Does Indesign Server Keep Crashing?

    Hello,
    I'm using InDesign Server 6 to run a publication with multiple products. I'm using a 3rd party plug-in to automate the process with a XML data file. When I start the script I created to run the publication through InDesign Server it runs fine when  the data file has a few products (3 or 4), but when I tried to run the script with a larger XML file it crashes and I get the following error message:
    Has anybody else encountered this error using InDesign Sever? I know the Sharedcontent plugin error usually means there is a file compatability issue, but my template files were all created in CS5.5, so that shouldn't be a problem. Also I've tested this process on the the desktop version of InDesign CS6 and the same data file doesn't cause a crash.

    Well, you're not using the most recent versoin of CS6. Try upgrading to 8.0.1.
    Windows APPCRASH messages are nearly useless I don't suppose you could try it on a Mac or on a Windows machine with WinDBG installed...

  • InDesign Server crashes on PDF export

    I've narrowed the problem down to the PDF presets we have defined.
    We have two PDF Presets that we use with our InDesign Server, one for low quality and one for high quality.
    When exporting a document using our high quality preset, IDS will sometimes crash altogether and will have to be restarted. We've never had this problem using our low quality preset.
    The only differences between the two presets are the image compression settings. Our HQ preset is set to 200PPI for color & grayscale images, while our LQ preset is set to 72 for color and 120 for grayscale images. Also, Image quality is set to High on our HQ and Medium on our LQ preset. Those are the ONLY descrepancies between the two.
    Does IDS have problems with exporting higher quality PDFs? Is this a known issue with ID?
    I can lower the quality of the PDF and it seems to fix the issue, but I'd like to know why this happens. Also, the whole purpose of exporting in HQ is to have a "high quality" PDF.
    Production Server Hardware -
    Windows Server 2008 R2 x64
    Two of these processors - Intel Xeon CPU X5570 @ 2.93 GHz - 8 cores
    20 GB of memory
    Software Running -
    Adobe InDesign Server CS5 v 7.0.3

    I don't use the server edition, but the regular version certainly doesn't have a problem with high resolution. I have once or twice, though, seen a problem with a custom preset created in an earlier version. This seems to have disappeared for me with the 7.0.3 update, though.
    Prests being as easy to creat as they are, though, you might want to try remaking any problem presets, starting from one of the canned presets if possible, and see if it makes a difference.

Maybe you are looking for