How I generate index markers using Applescript and tagged text!

One of the challenges I've faced in automating the book making process using Applescript with inDesign is that there don't seem to be any AS commands for making new index markers (anyone please correct me I if I'm wrong about this).
I've tried various js scripts which do an OK job, but they don't make the actual native markers. This means you have to wait until the book (consistiing of multiple ID files) is complete (so that all the page numbers have been established) to generate the index.
Recently, I read a tweet from someone with a link to a technique which uses tagged text and find and replace with GREP to edit the tags, inserting the tagged text index tags in the text file and then re-placing the text file in the ID page. In itself, this works great. But I'm dealing with literally thousands of separate text frames, none of them connected in a story.
The books typically consist of around 1200 pages with almost that many people, each of whose names I need to index with "Lastname, Firstname" references. And those particular strings don't (can't) appear anywhere on the pages. There will also be about 50 ID files all combined into one book. So it is imperative that I have ID generate the native index markers. To help keep things straight and efficient, I'm creating separate small text frames to hold the lastname, firstname strings. I created an object style for these frames which sets the attributes to "nonprinting", and I place the frames in the margin.
Then I realized that I don't actually have to have ID export the tagged text files for each. I exported one prototype and copied its tags to properties in my script, and then I concatenate them with the respective list item values I import from the database.
At the proper point in the page building script, I tell "textwrangleer" to make a new document, set its contents to the index string for the current record, save it to disk, overwriting the previous one, and then tell ID to "place" it in the index text frame, which generates the ID index mark.
I actually got an AS error when I first tried this: "file doesn't exist" or some such. Then I realized that the "place" command was happening too soon, so I inserted a .5 sec delay in the script, and it worked.
This is actually my first major script for actual work, and I'm so excited about it! I promises to cut production time down to about a thenth of what it was.
I still have to add some logic to branch between handlers with slightly different parameters for five different page formats, but the same page building handler will work on all of them.

A note on this:
Daniel Swanson wrote:
I've tried various js scripts which do an OK job, but they don't make the actual native markers. This means you have to wait until the book (consistiing of multiple ID files) is complete (so that all the page numbers have been established) to generate the index.
These scripts typically search for words and immediately write out the page numbers they are found on -- one shot indexing.
The solution is to add both the topic and its page reference to the current document's index:
if (app.activeDocument.indexes.length == 0)
    app.activeDocument.indexes.add();
app.activeDocument.indexes[0].topics.add(app.selection[0].contents).pageReferences.add(app.selection[0]);
The first lines only make sure there is an index to add to (per default, a new document has none).
The last line adds a selected word to the index (it must be a plain text string, hence the use of its 'contents'), and then adds a reference to the selection in the text itself.
Adding the same word a second time will for a change (quite untypically for ID's Scripting) not result in an error but simply add another page reference to the existing one.
When doing this in a loop: remember to work backwards, because the index marker itself gets inserted into the running text, and that will throw off your text indices.

Similar Messages

  • Is there a script that will generate Index Markers based on Notes?

    I need a way to generate index markers/entries within InDesign based on content that has been added in InCopy. I need this becasue InCopy users can't add Index Markers. One type of content they can add is Notes. Can I use these to generate index markers?
    N.b. I have figured a way for InCopy users to add character styles to words I can then generate a simple keyword index based on these. However I now need to be able to cater for sub level topics, cross references to other topics in the index and equivalent terms, and the character style method won't suffice.
    Any advice/tips on other methods to create indexes based on IC content would be useful.
    Thanks
    I'm using InCopy CS6 and InDesign CS6.

    Me again ;-)
    couldn't test with InCopy but I hope those lines will create a note if some text is selected. contents of the note = the selected text. create a shortcut to the script.
    #target InCopy
    try{
    currSel = app.selection[0];
    currContent = currSel.texts[0].contents;
    newNote = currSel.parentStory.notes.add(LocationOptions.BEFORE, currSel.insertionPoints[0]);
    newNote.texts[0].contents = currContent;
    }catch (e){
    alert(e)   
    changed the first script slightly. Note it's still just a example of how it could work:
    var currDoc = app.activeDocument,
    allStories = currDoc.stories,
    l = allStories.length;
    //checking for at least one existing index ...
    if(!currDoc.indexes[0].isValid){
            currDoc.indexes.add();
    while(l--){
    currStory = allStories[l];
    allNotes = currStory.notes;
    n = allNotes.length;
    while(n--){
    currNote = allNotes[n];
    noteContents = currNote.texts[0].contents
    //create the source
    currSource = currStory.characters.itemByRange(currNote.insertionPoints[0].index, currNote.insertionPoints[0].index + noteContents.length);
    currTopic = currDoc.indexes[0].topics.add(noteContents);
    //this is by default PageReferenceType.CURRENT_PAGE ... changes optionally
    currTopic.pageReferences.add(currSource)
    currDoc.indexes[0].update();
    currNote.remove();
    Hope it'll be of some help
    Hans-Gerd Claßen

  • How to generate Webservices.xml using tool in Sun One App Server?

    How to generate Webservices.xml using tool in Sun One App Server?

    Hi,
    The build.xml file should be in a directory from where
    you are running the asant command.
    To resolve the common.xml file not found error,
    open your build.xml and check from which location the common.xml file is incuded.
    In the sample application it is four directories above
    the directory where build.xml is located.
    You can copy the common.xml in the current directory and then change the following in your build.xml
    <!ENTITY include SYSTEM "../../../../common.xml">
    to <!ENTITY include SYSTEM "common.xml">
    Hope this helps.
    Get back in case you have more issues

  • How to generate pwm pulse using NI DAQ in MATLAB

    hi everyone. please tell me how to generate pwm pulses using Ni DAQ card in MATLAB Simulink. if through coding is possible then post the corresponding code.....reply me 

    Make sure you have installed the Measurement studio support for VB 6.0 then you will be able to find examples in the folder below on win7 and 8.
    C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples
    Narrow down to Analog Output and choose update voltage example for measurement studio.
    You also have the possibility to use DAQ assistant if you have measurement studio installed. This function is a configuration type programming. After going through the configuration Wizard code is automatically scripted for you so that you can output the voltage you need. Read more about DAQ assistant in the blow link.
    http://www.ni.com/white-paper/4652/en/
    Best Regards
    Jonas Mäki
    Applications Engineering
    National Instruments

  • Very Urgent..How to create a report Using SQ01 and Sq02.

    Hi Friends,
    It's very urgent.pl help  me in generating a report using SQ01 and SQ02.
    Help is appreciated.
    thanks In advance.
    Regards,
    Nanditha.

    Check out these links...
    http://www.insightcp.com/res_15.htm
    http://www.ams.utoronto.ca/Assets/output/assets/adhoc_2990830.pdf.pdf
    Also, do basic search in this forum...you will find a lot of threads related to this.
    SKR

  • How to generate addm report using grid

    Hi,
    how to generate addm report using grid, please provide any relevant doc/links etc.
    Thanks in advance.

    how to generate addm report using grid, please provide any relevant doc/links etc.When you start with the wrong question, no matter how good an answer you get, it won't matter very much.
    what is best way to divide board into 2 pieces using a hammer?
    Edited by: sb92075 on Oct 25, 2010 7:22 AM

  • How to connect one page using button and by link in BSP

    how to connect one page using button and by link in BSP

    hi,
    use on 'onclick' functionality.
    1. In layout, onclick = 'NEXT_PAGE' of the button
    2. Capture the event in onInputprocessing,
    DATA: event_id TYPE REF TO  cl_htmlb_event.
    case event_id.
    when 'NEXT_PAGE'.
                navigation->goto_page( 'URPAGE URL' ).

  • Explain How delivery date is calculated using backward and forward schedul

    How can anyone please explain how delivery date is calculated using forward and backward scheduling
    I want to have it broken down into the following steps
    for eg for delivery date calculation following dates are used
    Material Availabilty Date
    Material Staging Date
    Pick/pack time
    Transportation PLanning date
    Loading date
    Goods issue date
    Transit Date
    Delivery Date
    Can some one please give me an example and explain wht these dates are
    for eg customer needs delivery date on  11/20/2008
    how would the system cacluate whether it can meet the delivery date using backward scheduling
    and if it doesnt meet how does the system do the forward scheduling
    also i am not clear with the following dates
    material avaialibilty date
    material staging date
    transportation date
    can some one please explain me all this in detail
    Thanks

    Hi,
    Basically this is the CRSD(Customer requested ship date logic)logic in which system calculates the ship date depends upon the material availability. If material is available system calculates ship date on the basis of master data maintained in customisation.Master data is maintained in the  following link.
    If material is not available then system takes into consideration vendor delivery date & then calculate customer ship date.
    Please go through the link in SPRO
    LE-Shipping -Basic shipping functions-Scheduling -Delivery scheduling & Transportation scheduling-Maintain duration.
    In customisation following data is maintained
    Material Availabilty Date
    Material Staging Date
    Pick/pack time
    Transportation PLanning date
    Loading date
    Goods issue date
    Transit Date
    Delivery Date
    Hope you got the idea of CRSD calculation
    Regards,
    Prashant.

  • Generating Parent Number using Level and Display Number

    I am facing problem in generating parent number using level and dispaly number.
    Here is the table structure
    CREATE TABLE test(
    DISPLAY_NUMBER       NUMBER,
    LEVEL_NUM           NUMBER,
    COMPONENT   VARCHAR2(10))
    INSERT INTO test VALUES (1,1,'A');
    INSERT INTO test VALUES (2,2,'B');
    INSERT INTO test VALUES (3,3,'C');
    INSERT INTO test VALUES (4,4,'D');
    INSERT INTO test VALUES (5,3,'E');
    INSERT INTO test VALUES (6,3,'F');
    INSERT INTO test VALUES (7,2,'G');
    INSERT INTO test VALUES (8,3,'H');Here is the output table structure and required output data format
    CREATE TABLE test1(
    DISPLAY_NUMBER       NUMBER,
    LEVEL_NUM           NUMBER,
    COMPONENT   VARCHAR2(10),
    PARENT VARCHAR2(10))
    INSERT INTO test1 VALUES (1,1,'A',NULL);
    INSERT INTO test1 VALUES (2,2,'B','A');
    INSERT INTO test1 VALUES (3,3,'C','B');
    INSERT INTO test1 VALUES (4,4,'D','C');
    INSERT INTO test1 VALUES (5,3,'E','B');
    INSERT INTO test1 VALUES (6,3,'F','B');
    INSERT INTO test1 VALUES (7,2,'G','A');
    INSERT INTO test1 VALUES (8,3,'H','B');Oracle database version : Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    Thanks in advance.
    Regards,
    Laxman

    >
    I am facing problem in generating parent number using level and dispaly number.
    >
    Thanks for posting the table DDL and data. I called the tables testa and testb.
    insert into testb
    select a.*, (select component from testa b where b.level_num + 1
      = a.level_num and rownum = 1) parent
    from testa a
    select * from testb
    DISPLAY_NUMBER,LEVEL_NUM,COMPONENT,PARENT
    1,1,A,
    2,2,B,A
    3,3,C,B
    4,4,D,C
    5,3,E,B
    6,3,F,B
    7,2,G,A
    8,3,H,B

  • How to refresh table display using slis and 'reuse_alv_grid_display method.

    hello,
    how to refresh table display using slis and 'reuse_alv_grid_display method'.
    when i'm refreshing table display it performs once again reuse_alv_grid_display.and when i back the previous value appear.how to solve it?
    neon

    are you chaning any value in the gird if so use this..
    Pass the user_command form name to the Import parameter
    I_CALL_BACK_USERCOMMAND .
    and have the Dynamic form implementation..
    FORM user_command USING ucomm TYPE sy-ucomm
                selfield TYPE slis_selfield.
    "The below is important for Editable Grid.
      DATA: gd_repid LIKE sy-repid, "Exists
      ref_grid TYPE REF TO cl_gui_alv_grid.
      IF ref_grid IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            e_grid = ref_grid.
      ENDIF.
      IF NOT ref_grid IS INITIAL.
        CALL METHOD ref_grid->check_changed_data .
      ENDIF.
      CASE ucomm.
        WHEN 'REFRSH'.
      ENDCASE.
           selfield-refresh = 'X'.
    ENDFORM.                    "user_command

  • How to find index name with primarykey and column on a table?

    Hi,
    how to find index name with primarykey and column on a table?
    please help me.
    Thankyou.

      1  select ac.table_name, ac.index_name, aic.column_name
      2  from user_constraints ac, user_ind_columns aic
      3  where ac.constraint_type = 'P'
      4   and  ac.index_name = aic.index_name
      5* order by 1,2,3
    SQL> /
    TABLE_NAME                 INDEX_NAME                COLUMN_NAME
    ACTION_TABLE                 SYS_C0011033                NESTED_TABLE_ID
    ACTION_TABLE                 SYS_C0011033                SYS_NC_ARRAY_INDEX$
    CATEGORIES_TAB                 SYS_C0011038                CATEGORY_ID
    CUSTOMERS                 CUSTOMERS_PK                CUSTOMER_ID
    INVENTORIES                 INVENTORY_IX                PRODUCT_ID
    INVENTORIES                 INVENTORY_IX                WAREHOUSE_ID
    LINEITEM_TABLE                 SYS_C0011034                NESTED_TABLE_ID
    LINEITEM_TABLE                 SYS_C0011034                SYS_NC_ARRAY_INDEX$
    ORDERS                      ORDER_PK                 ORDER_ID
    ORDER_ITEMS                 ORDER_ITEMS_PK                LINE_ITEM_ID
    ORDER_ITEMS                 ORDER_ITEMS_PK                ORDER_ID
    PRODUCT_DESCRIPTIONS            PRD_DESC_PK                LANGUAGE_ID
    PRODUCT_DESCRIPTIONS            PRD_DESC_PK                PRODUCT_ID
    PRODUCT_INFORMATION            PRODUCT_INFORMATION_PK           PRODUCT_ID
    PROMOTIONS                 PROMO_ID_PK                PROMO_ID
    WAREHOUSES                 WAREHOUSES_PK                WAREHOUSE_ID
    16 rows selected.

  • How to generate payment advice in F110 and send it to Vendors Via Email

    Dear SAP Experts
    Could anybody tell me how to generate payment advice in F110 and send it to Vendors Via Email?
    It would be much appreciated if someone can provide the configuration procedure, thanks so much in advance.
    Cheers & Best Regards
    Ray

    Hi Sama,
    Thanks for your post, here I just share some of my idea.
    The following step is to configure the payment advice.
    In OBVU (payment methods in cpy code) I entered my payment advice form
    In OBVU (payment methods in cpy code)  set  "Always pyt advice"
    In OBVCU (payment method by country)  leave the payment medium program (RFFOD__T)
    For the email sending program, should develp some customized program to realize that, Thanks.
    Cheers & Best Regards
    Ray

  • How to generate the reports in BI and display in EP ?

    Hi All
       I am new to BI but i am working on EP
       Can any one help me how to generate the reports in BI and should be displayed
       in EP frontend?  So what and all settings and installations i need to do ?
       Any documents on this will be really helpful to me..........
    Adv...thanks and regards
    Kops

    Hi kops,
    Check the links below.What you need is there..
    How can i place a query developed in BEX to portal
    http://help.sap.com/saphelp_nw04s/helpdata/en/43/92dceb49fd25e5e10000000a1553f7/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/33/39fa40ee14f26fe10000000a1550b0/frameset.htm

  • How to generate multiple sheets using xml publisher

    Hi,
    how to generate multiple sheets using xml publisher.
    Thanks,
    Nur

    http://lmgtfy.com/?q=how+to+generate+multiple+sheets+using+xml+publisher

  • I ask the third time: How can I enlarge the menue symbols and the text of the menue in Photoshop CS6 vers.13 so that I can read them??? My laptop has Win 8.1 and a screen resolution of 3840x2160

    I ask the third time:
    How can I enlarge the menue symbols and the text of the menue in Photoshop CS6 vers.13 so that I can read them??? My laptop has Win 8.1 and a screen resolution of 3840x2160.
    It is unbelievable that such an expensive software does not provide a proper lay out wit a high screen resolution!
    It is also unbelivable that it is not possible to get a qualified employee of ADOBE on the phone in Germany.
    hope of feed back: e-mail: [email protected]

    Chris Cox answered your question here:
    I have PS cs6 extended and a new laptop with screen resolution of 3840x2160. Now all control elements and menues are so small that I can not reed them. How can I make them readable without reducing the resolution of the schreen?

Maybe you are looking for