Create TOC javascript for indesign book

Hi friends,
i am new to indesign javascript. i want to create a javascript for TOC indesign book using paragrph style
could anyone help me. i am strugling long time.

"It didn't work for me" doesn't work for me. Always, always, always, state why it doesn't work for you.
Did you try to use it, but could not get it to work?
Or, do you need to do something special that the built-in function does not do?
It should not be extremely hard to make a javascript version that does (roughly) the same. You could try something like this:
For every paragraph style you want to include (most likely all sorts of headings),
Search for all occurrences, and store the text, its page number, and (important!) its story offset in an array.
You need the text because that's what will appear in the TOC.
You need the page number because, well, that's what the TOC is for :-)
Most important: you need the story offset so you can reconstitute the original order of the headings. You can only search for one level of heading at a time, so without sorting, you would get "Heading 1 -- Heading 1 -- Heading 1 -- Heading 2 -- Heading 2 -- Heading 2" (etc.)
When you have gathered all of the information for your entire book, sort on story offset. (I forgot, it's for a Book, right? You need to store a document id as well, so you can sort throughout multiple documents.) (See Ed.)
Then write out every text in the right order, followed by its page number.
The IndexMatic script that Marc points out should already contains lots of the logic described here -- esp. searching and storing page numbers.
[Ed.] Thinking about it, a Book (multiple documents) should *not* cause any problems, and you don't need to know in which document some text was found. Simply sort the paragraphs on their page number; only when these are the same for more than one paragraph, sort just these on their Story Offset. Logically, there should not be two headers with the same page number in two different documents.

Similar Messages

  • Create TOC javascript using paragraph style

    Hi,
    i want to create javascript for TOC in new indesign document or book. but i want to use input style for paragraph styleHi,

    "It didn't work for me" doesn't work for me. Always, always, always, state why it doesn't work for you.
    Did you try to use it, but could not get it to work?
    Or, do you need to do something special that the built-in function does not do?
    It should not be extremely hard to make a javascript version that does (roughly) the same. You could try something like this:
    For every paragraph style you want to include (most likely all sorts of headings),
    Search for all occurrences, and store the text, its page number, and (important!) its story offset in an array.
    You need the text because that's what will appear in the TOC.
    You need the page number because, well, that's what the TOC is for :-)
    Most important: you need the story offset so you can reconstitute the original order of the headings. You can only search for one level of heading at a time, so without sorting, you would get "Heading 1 -- Heading 1 -- Heading 1 -- Heading 2 -- Heading 2 -- Heading 2" (etc.)
    When you have gathered all of the information for your entire book, sort on story offset. (I forgot, it's for a Book, right? You need to store a document id as well, so you can sort throughout multiple documents.) (See Ed.)
    Then write out every text in the right order, followed by its page number.
    The IndexMatic script that Marc points out should already contains lots of the logic described here -- esp. searching and storing page numbers.
    [Ed.] Thinking about it, a Book (multiple documents) should *not* cause any problems, and you don't need to know in which document some text was found. Simply sort the paragraphs on their page number; only when these are the same for more than one paragraph, sort just these on their Story Offset. Logically, there should not be two headers with the same page number in two different documents.

  • Add photo to book - after already created initial album for that book.

    i would like to add a new photo to an existing book. but i can't figure out how to import it to the album i used for this book. any tips would be appreciated.

    You do not add it to the album you started with (you can but it has nothing to do with the book) - to add a photo to a book (or an album for that matter) you simply drag it from the event to the book in the source pane on the left
    LN

  • Creating an index for a book

    The manual implies that I can just create an index by selecting on of the master pages but when I look in my particular theme (Modern Lines) there is no such page to choose from The create index button is grayed out in the action pop-up. I saw where people had previously asked this question with no answers provided.

    I found this old post and was sorry to see that no one responded since I am having the same problem. Not only that, the User Manual says that there is an index page among the master pages but I didn't see any. can anyone help?

  • How to set time delay in javascript for indesign cs2?

    while am running the js, am using function date.getMonth, date.getDate()...
    this function produce the error, which return the function as error message,
    if i set alert before running this every time , am not getting the errror
    how to solve this?
    thanks in advance
    subha

    Dear Subhaoviya
    Please use the below coding and get your date and Time functions
    var today = new Date();
    var myDate = today.getDate();
    Thanks & Regards
    T.R.Harihara SudhaN

  • How can i create a plugin for adobe in design CS3

    i'm trying to make a plugin to use it in adobe Indesign CS3 program but i can't
    i'm using Windows 7
    i had tryed to make a plugin using Eclips with indesign plugin editor and Visual studio C++ but i can't as i can;t find where can i write my code and there is also an error while debuging is that :
    <error PRJ0019: A tool returned an error code from "Performing Custom Build Step">
    after working out  this error "by adding the directory of Odfrc.exe in tools->VC++ Directories->executable file" another error raise to me :
    <Unknown compiler version - please run the configure tests and report the results> and the visual studio raise message box to me to specify the name of the executable file to be used for the debug session
    i don;t know wat can i do know all i need to create a plugin for indesign program so could any one help me ??

    Each version of the SDK has very specific demands for the compiler setup, and this in turn relies heavily on the operating system. The CS3 SDK probably was based on a much older version of Visual Studio.
    Compare your toolchain against the requirements that should be stated somewhere in the CS3 documentation. It's a solid bet you are years ahead -- there simply is no reason for Adobe to keep on supporting all OSes and compilers that continue to appear, for a version of InDesign that's by now 2.5 versions old.

  • Script exe for indesign cs2 is possible?

         i wrote a javascript for indesign cs2 application, user move that to script folder and run it.
    sometimes they edit the script for their own, it makes some problem.
    is it possible to make the script in exe format.
    by using Extend toolkit2 if i make it as binary format indesign cs3 accepts it, but the script not view in cs2 palette...
    how to solve it?
    thanks
    subha

    the scripts for Indesign can be exported as a binary format using the ExtendScript toolKit..
    This might prevent users from modifying them.
    However this jsxbin format can only be used in CS3 and CS4.
    Mayb u may consider upgrading to CS3 / CS4..
    hope this helps..

  • Downloading InDesign book files from Creative Cloud files

    Gang,
    I'm working on a project that has me using the Creative Cloud files to store the changes I make. I know I'm not using all of the features, but with my own personal account on two machines and my employers site license on the other, I end up using the browser version of Creative Cloud to upload and download files on my work computer.
    When I download a book file (.indb), Creative Cloud and my browser seem to get confused as to what kind of file it is. Creative Cloud asks me and doesn't have an option for InDesign Book. When it downloads, it downloads as a .octet-stream file. I later go to Finder and change the extension to indb and life is good.
    Is this a bug or a feature?
    Warren BIngham

    This is a bug. Will update this thread once it is fixed.

  • How to find Opening Balance for Cash Book

    Hello Friends,
    I am Creating one Report for Cash Book.(Means : For Perticuler GL Account)
    I have no idea how to find Opening Balance for some Perticuler Date.
    Ex.
         Current date: 07/06/2007
        and i want to find Opening Balance on 26/05/2007
    i have Function for Calculating Opening Balance,                                                                               
    Group No: 3006             Business Object General Ledger Account  
    BAPI_GL_ACC_EXISTENCECHECK     Check existence of G/L account                  
    BAPI_GL_ACC_GETBALANCE     Closing balance of G/L account for chosen year  
    BAPI_GL_ACC_GETCURRENTBALANCE  Closing balance of G/L acc for curr year
    BAPI_GL_ACC_GETPERIODBALANCES  Posting period balances for each G/L account    
    but they show current opening balance, and i want for perticulaer Date..
             How to find Opening Balance for Cash Book
    please Help me out
    Thanks
    Gaurav Tripathi

    Hi Maruthi,
       Opening balance for a cutomer for a given period, u need to first find closing balance of that customer in the previous period. For eg. Suppose u want to find opening balance for customer 'A' for month of Nov'06, then U have to find wot was his closing balance in at end of Oct'06. Hope this solves u r problem

  • How to export book pdf using custom presets for all book files in indesign using javascript

    How to export book pdf using custom presets for all book files in indesign using javascript.

    Hi jackkistens,
    Try the below js code.
    Note: you can change your preset name in below (e.g, Your preset name).
    var myBook = app.activeBook;
    myBook.exportFile(ExportFormat.PDF_TYPE, File (myBook.filePath+"/"+myBook.name.replace(/\.indb/g, ".pdf")), false, "Your preset name", myBook.bookContents, "Book_PDF", false);
    example:
    var myBook = app.activeBook;
    myBook.exportFile(ExportFormat.PDF_TYPE, File (myBook.filePath+"/"+myBook.name.replace(/\.indb/g, ".pdf")), false, "[High Quality Print]", myBook.bookContents, "Book_PDF", false);
    thx,
    csm_phil

  • Has anyone experienced 'Parent' & 'Child' TOC (bookmark version) issues, when using an InDesign Book to create a fixed format ePub3?

    Hello,
    I'm using the latest versions of AdobeCC and Indesign on the mac to generate fixed format ePub3 files.
    I have an Indesign Book which is comprised of 9 documents (chapters). When I create a bookmark based Table Of Contents, I'm finding that I'm having trouble getting the 'parent' and 'child' hierarchy perfect. This is because some 'child' bookmarks need to be under the 'parent' of one document within my book, and yet I need to add the bookmark from a different document (or chapter).
    In essence, I'm asking is there a way of having a 'child' bookmark in one document, nestled under a 'parent' on a different document within my InDesign book? All I seem to get are repeats of the 'parent' rather than it looking at all of the documents and synching them.
    In the screenshot below (the larger circle), I have added sharks as a parent folder in one 'document/chapter', and then later on in the book (in a different document/chapter, another shark needs to be added to the list under the sharks parent, and yet it doesn't give me the option to add it as a Child to sharks. I created another sharks parent in this later document thinking I might be able to synch across all documents, but all it seems to do is create a duplicate.
    Any help appreciated!
    Thanks, Joe

    Just thought that a much better way of phrasing what I initially asked would be: Is there is a way to synchronize bookmarks across all documents in a book?
    Thanks
    Joe

  • InDesign CS5 (Mac) document is on strike (hangs for .idml, creating ToC)...

    1. Document A: Tried to create a Table of Contents to replace the one I already have. INDD beachball.
    2. Force quit INDD and restarted. On TOC re-creation with new style, same result. Force quit again.
    3. Restarted Mac
    4. Same result as 1. Set up a new style TOC, with and without PDF hyperlinks. Same result.
    5. Reset INDD preferences. Reopened Document A, tried to create ToC. Same result.
    6. Document B: Tried to create a TOC in another document. No problems, so must be document, rather than INDD as a whole.
    7. Document A: Reopened original buggy document, tried to create IDML, but it froze at 57%. Force quit again...
    What can I do to get a non-buggy, working document A? It has variables and cross-references but so does Document B.

    Thank you Jongware for your suggestion.
    Open as Copy did not work so I decided to go back to the previous version (I always make a new document when the client sends the next set of changes) and re-did around 5 hours of work, but now I have an up to date version that does not keep crashing and with all the cross-references working really well. Thought this would be better than sending it over to you because I guess no one would be able to fix what was causing the document to crash at the 57% point of idml creation or when clicking on the make ToC button.
    I guess at the 57% point INDD is working on the table of contents or cross-references or those dratted variables which cause any document to crash if text containing them is selected. That is a bug which I wish Adobe would fix pronto. Only happens on Macs not the PC version of CS5 apparently.

  • Where can I find a Javascript developer for InDesign scripting?

    Hi
    as
    I apologise in advance for posting on a technical site for InDesign developers, but our company (Dorling Kindersley) is looking for a full-time permanent developer to join our team. I've been looking for some months now and I would really appreciate some advice on where or how InDesign scripters look for work, as our role is quite specialised.
    We can offer an attractive package and although I'm biased as I work there, Dorling Kindersley really is a nice place to work - fun, friendly and super creative. I would welcome advice or for someone to approach me if they're interested.
    It's advertised as full-time and permanent but for the right candidate we can offer flexible working conditions.
    Best
    Heather Hughes
    Publishing Technologies Software Developer (permanent role)
    We’re looking for an enthusiastic individual keen to join our Creative Technical Support team, to create, maintain and enhance software tools for our creative and operations teams around the globe. This is a permanent full-time role.
    Each tool is a script or collection of scripts that allows DK to automate their creative workflows, from checks that spreads and covers have been created correctly to automated deployment of colour settings.
    The ideal candidate will have solid experience of using scripting to command Mac OS and Adobe products, have strong analytical skills and be curious, patient and willing to learn new skills. If you have design, publishing or print experience this will be an asset, but we can help fill in the gaps with training and guidance. You’ll need to be a ‘people’ person as most of the people you’ll come into contact with won’t have a software development background.
    Not only do you get to work next door to Covent Garden, in the heart of London, but  you’ll be welcomed into a small team of  friendly and irreverent geeks, who are experts in Adobe applications and workflows  and helping creative teams overcome their technical problems. Lunchtimes are often spent getting out and sampling the local cuisine in the vast number of restaurants and eateries around the office.
    You’ll get to work in a relaxed, sociable and friendly environment, working alongside our award-winning creative staff to develop their ideas for tools and get satisfaction from freeing them up to be even more creative.
    Skills required:
    Excellent skills and experience in using Javascript
    Experience of working with Macs and Adobe applications preferred
    Other programming skills and experience an advantage, e.g.  Applescript, Adobe InDesign Document Object Model, XML structure, TDD, Shell Script, Obj-C, C++ and Xcode
    Ability to learn new technologies swiftly
    Why work for DK?
    DK is an award-winning global publisher of distinctive, highly visual products for adults and children alike. We have a reputation for producing innovative design and digital products.
    Everything we make from books, eBooks and apps give unrivalled clarity to topics with a unique combination of words and pictures, put together to spectacular effect.
    We produce content for consumers in over 52 countries and 42 languages from offices in Delhi, London, Melbourne, Munich, New York and Toronto. We celebrate our 40th birthday this year, and we are enormously proud to be the world’s leading illustrated reference publisher.
    You’ll  be joining an awesome and highly talented, diverse and creative team, in an environment where everyone is encouraged to learn and coach new skills, as well as having the opportunity to grow and develop with people who are passionate about what they do.

    Hi Heather,
    I think you've found probably the best place possible to post this opening.
    I personally am interested, and would like to pursue this further. My email is admin [at] freelancebookdesign.com
    Thanks,
    Ariel

  • Cross reference or hyperlinking not working for InDesign CS5 Book to ePub

    I cannot get hyperlinks or cross reference links to work when generating an ePub from InDesign CS5. (7.0.0.355, Mac OS 10.6.2)
    Here's how to recreate a simple test demonstrating the issue.
    1. Create a new InDesign Book (File -> New -> Book)
    2. Create document one (File -> New -> Document)
    3. Create a text box and type "Table of Contents"
    4. Create document two (File -> New -> Document)
    5. Create a text box in it and type "Story One"
    6. Create a new paragraph style and assign it to the Story One text
    7. Save document 2. I just kept the name Untitled-2.xhtml
    8. Back in document 1, add a cross-reference and select document 2, the style you created, and then "Story One". "Story One" should now appear under the previously typed Table of Contents text, and when highlighed, should show it is an active cross reference in the Hyperlinks panel.
    9. Save document 1. I just kept the name Untitled-1.xhtml
    10. Add both documents to the Book and save the book.
    11. From the Book panel, select Export Book to EPUB...
    12. Save the epub file and open it in Adobe Digital Editions.
    Note that the text "Story One" appears as a hyperlink but when clicked does not switch to the document 2. It does nothing apparent when clicked.
    Looking at the XHTML source for the first document, it is immediately evident why. The filename for document 2.thml is missing.  It looks like this: <a href="#anchor-anchor">
    When it should be : <a href="Untitled-2.xhtml#anchor-anchor">
    The same thing works if you create a hyperlink instead of a cross reference.
    I note then when I use the option to go to the destinate reference in the Cross Link (hyperlink) panel, it does switch to the second InDesign docuemtn. So the cross reference is functioning (in InDesign). But the link is broken in the ePub for the above mentioned reason.
    Bug? Something I'm overlooking?
    Entire source of Untitled-1.xhtml:
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Untitled-1.xhtml</title>
    <link href="template.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <div id="untitled-1">
    <div class="generated-style">
    <p class="basic-paragraph" xml:lang='en-us'><span class="no-style-override">Table of Contents</span></p>
    <p class="basic-paragraph" xml:lang='en-us'><span class="no-style-override"><a href="#anchor-anchor">“story one”</a></span></p>
    </div>
    </div>
    </body>
    </html>

    As far as I can tell, it has NOT yet been fixed in CS5.5.  I'm having the same problem.  I have about 90 hyperlinks to fix.
    And the explanation that Teus Dejong gives indicates it's not going to be that helpful:  "we have found that only the links in documents split by the CS5 exporter will be fixed. For books the script does only work for references to earlier documents in the book, not for forward references. This means in practice that for most books the script will not repair the links and should be seen as a means to add the year only. At the moment I see no way to repair this, because the book epub output of InDesign does not contain sufficient information to repair links referencing forward to others documents in a book."
    It's pretty discouraging.

  • Creating an index in InDesign CS3 - is there any way to limit where and for what it looks?

    I'm creating an index for a 300-page book using InDesign CS3 on both a PC with Windows XP home and a MacPro with OS X Leopard (I take this book back and forth between these two computers). I have created this as a book (.indb) file so I can use the Index panel with the book option checked to include all of the book chapters.
    There are two things I was wondering how to do, if they can be done at all.
    1 - I want the index to look for entries in the main pages only, not in the master pages.
    2 - I'd like to be able to do only attributed text. For example, I'd like the index to find only the word people when it is bold and italic, and not all of the other places it may occur. Can I do this with a style also, paragraph and/or character?
    Thanks so much,
    Marcy

    Read http://help.adobe.com/en_US/InDesign/6.0/WS8721440D-5F68-4fd6-8115-CA3BEDACF001a.html (the online Help on indexes) -- it will probably answer a few questions.
    One I do know immediately is your question on "picking up" stuff from master pages and only with formatting. InDesign does not make an index for you -- you have to (oh! manual labor!) mark the words that should appear in the index yourself. So just don't mark them on master pages, or when not bold and/or italic. You might be wondering about that little button "Mark all instances", well, it does what it say, and in your case you do not want to mark all instances.
    The Capitalization issue is, AFAICR, somewhere in the Help; and so is your singular/plural stuff. The latter one is easy solved: if you mark a word to be indexed, ID asks you in a friendly dialog how it should be included, and that defaults to the current selected phrase, but you are free to edit the text in that dialog. ID does not mark the word or phrase; it inserts an invisible marker inside the to-be-indexed word that contains all information you enter in the Add Index Entry dialog, and it uses that to determine what page number to add. (That invisible marker is visible with "Show Invisible Characters", and can be cut, pasted and deleted at will -- so to remove a water melon, find the marker, and delete it.)

Maybe you are looking for

  • I haven't been able to send an email through my hotmail account via the email app since my iPhone 3GS

    What can I do? It keeps asking for a **** password and I enter my email. Password and it doesn't work And keeps sending me back to settings for my pop.3 Password!

  • Scanners usable with Fast User Switching

    Which mid-range scanner operates with multiple logged users? Manufacturers seem poorly equipped to answer this, since they test their products with only one user logged in-their support people come up empty-handed.  I work in a small but busy office

  • Apache Web Server not working correctly

    Hello all, I have enabled web sharing and put a file in my "sites" folder under my username. I have instructed my friend to paste the link into his browser, he is using Leopard 10.5.5 as well, and it says that Safari can not find the server. The box

  • Account Lockout source process / application

    Hello There, I am using "Account Lockout Status" and also "Netwrix Account Lockout Examiner" which is really helpful. I have a situation one of the user account is getting locked out everyday i tried to trace the source but in all the cases it shows

  • Dark Prints When Using CS3

    have just begun using CS3 10.0.1 on an iMac (using 10.5.2) and am experiencing darker than normal prints. My setup is as follows: Color Settings In Photoshop: RGB: Adobe RGB (1998 (but have now begun using ProPhoto RGB) CMYK: US Web Coated (SWOP) v2