Applescript to Export text from Indesign and import to Microsoft Excel.

Discussion in 'Mac Programming' started by alissat, Mar 26, 2013.

  1. alissat macrumors newbie

    Mar 26, 2013
    Help, I am new to the applescript world.
    I need to extract text from multiple pages of Indesign and import the text into Microsoft Excel.
    I tried using Rorohiko Text Exporter which does extract the text and save the file to a text file, but when I import the file into Excel it puts all of the text in Column A and I need certain text fields to go to certain columns and rows. Since each text field is in its own text box within Indesign I cannot designate the file to be tab or comma delimited. They are separated only by line breaks.
    So how do I designate certain text to certain columns and rows?

    Any help would be greatly appreciated
  2. macmesser macrumors 6502a

    Aug 13, 2012
    Long Island, NY USA
    You can append a tab to the value of any text variable simply with a statement like this (pseudocode):

    tell inDesign
    set theText to the text of textbox 1
    set the text of text box 1 to theText & tab
    end tell

    I don't know if inDesign internally uses the tab char for tabbing or if you already have tabs in the existing text boxes. You might have to use some other delimiter or if you must export to tab delim, convert existing tabs to something else before appending tabs. If no tabs in the existing text boxes just append a tab.

    Substituting one character for another in text is easy with plain vanilla Applescript by playing with "Applescript's text item delimiters".

    Hope this is marginally helpful. I recently had a similar problem exporting custom field values from Extensis Portfolio in to Filemaker Pro.

Share This Page