IDCS6 MACOSX JS: Data Merging many txt files one after another

Hello everybody.
I have a situation where I have to data-merge many text files to the one actual indesign "base" file. The formats of the databases are all the same, the point of difference is a code in the second field of the database that refers to a mailing zone (not a zip/postcode, a "distribution centre" code that has 56 or so possibilities). I would prefer to data merge one file and then somehow split the resulting PDF via Acrobat, but the length of the resulting mailing zones is inconsistent and something that can't be done though the "split document" feature in acrobat.
The database starts out as one massive file but using a one-line  code, can be split into its mailing zones into separate text files.
My ultimate question: is there any way to data merge more than one file at once (e.g. one after another) and give them their names based on the names of the input text file?
Ole Kvern had a script to Data Merge one file without the UI. I have altered the last line slightly so that it outputs to a PDF based on [High Quality Setting]:
if(app.documents.length != 0){
        var myDocument = app.activeDocument;
        app.dataMergeOptions.removeBlankLines = true;
        //Select a source file.
        var myDataFile = File.openDialog("Select a data file")
        var exported = "file location(redacted for the sake of this post)"
        if(myDataFile != ""){
                myDocument.dataMergeProperties.selectDataSource(myDataFile,);
                myDocument.dataMergeProperties.exportFile(exported,"[High Quality Print]",);
I figure the answer has to do with the variable "myDataFile" and rather than being simply open a dialog, it would be somehow selecting an array of text files, but this is where I am out of my depth.
Any insights or other thoughts that may not involve trying to do many merges at once but may somehow revolve around one large merged PDF?
Many thanks
Colin

I've answered my own question, but the answer lies outside of Adobe InDesign – it uses bookmarks within Adobe Acrobat.
1) Data Merge the art/data to one large PDF file.
2) In the resulting PDF file, manually search out the mailing zones and apply bookmarks to each first instance only of each mailing zone. In this case, it is a manual process of find/replace to find one of 70 possible mailing zones that may be used in any database. Each bookmark should be named with its respective code. It is a manual process, but it would take 5 minutes so this is acceptable.
3) Using "Split Document" from the pages panel, make sure the "top level bookmarks" radio button is checked, and in the Output Options make sure that the "Use bookmark names for files" radio button is checked.
I'm aware that this was a rather obscure question that only a fraction of users on this forum may wish to know an answer for, but hopefully this workaround helps someone else in a similar situation.
Colin

Similar Messages

  • How do i play two sound file one after another

    Hi All,
    How do i play two sound file one after another using single AudioClip Component?.
    Advance in thanks
    Manivel

    AudioClip gives you very little control over what happens to the sound, it also isn't capable of playing long clips or waiting until a clip ends. It will play multiple clips over top of each other.
    To do what you want you should use the facilities of javax.sound. Here's a post with an example: http://forum.java.sun.com/thread.jspa?forumID=513&threadID=450768
    There is also a tutorial, but its example fails for long clips.

  • I have a VI and an attched .txt data file. Now I want to read the data from the .txt file and display it as an array in the front panel. But the result is not right. Any help?

    I have a VI and an attched .txt data file. Now I want to read the data from the .txt file and display it as an array in the front panel. But the result is not right. Any help?
    Attachments:
    try2.txt ‏2 KB
    read_array.vi ‏21 KB

    The problem is in the delimiters in your text file. By default, Read From Spreadsheet File.vi expects a tab delimited file. You can specify a delimiter (like a space), but Read From Spreadsheet File.vi has a problem with repeated delimiters: if you specify a single space as a delimiter and Read From Spreadsheet File.vi finds two spaces back-to-back, it stops reading that line. Your file (as I got it from your earlier post) is delimited by 4 spaces.
    Here are some of your choices to fix your problem.
    1. Change the source file to a tab delimited file. Your VI will then run as is.
    2. Change the source file to be delimited by a single space (rather than 4), then wire a string constant containing one space to the delimiter input of Read From Spreadsheet File.vi.
    3. Wire a string constant containing 4 spaces to the delimiter input of Read From Spreadsheet File.vi. Then your text file will run as is.
    Depending on where your text file comes from (see more comments below), I'd vote for choice 1: a tab delimited text file. It's the most common text output of spreadsheet programs.
    Comments for choices 1 and 2: Where does the text file come from? Is it automatically generated or manually generated? Will it be generated multiple times or just once? If it's manually generated or generated just once, you can use any text editor to change 4 spaces to a tab or to a single space. Note: if you want to change it to a tab delimited file, you can't enter a tab directly into a box in the search & replace dialog of many programs like notepad, but you can do a cut and paste. Before you start your search and replace (just in the text window of the editor), press tab. A tab character will be entered. Press Shift-LeftArrow (not Backspace) to highlight the tab character. Press Ctrl-X to cut the tab character. Start your search and replace (Ctrl-H in notepad in Windows 2000). Click into the Find What box. Enter four spaces. Click into the Replace With box. Press Ctrl-V to paste the tab character. And another thing: older versions of notepad don't have search and replace. Use any editor or word processor that does.

  • Populate a table reading the data from a TXT file

    how can I populate a table reading the data from a TXT file?
    thanks

    Hey Kevin!
    Using FORMS.TEXT_IO to bulk load data from a file strikes me as re-inventing the wheel. It is just about justifiable in a self-service environment, but I regard the EXTERNAL TABLE is a better solution for that situation as well.
    The same applies to UTL_FILE. I think the ability to read text with UTL_FILE is primarily intended for read file-based configuration or file manipulation/processing rather than data loading.
    Re-writing a text file into SQL statements is too much like hard work (even with an editor that supports macro definition and regular expressions) for no real benefit. You lose all the bulk load peformance you would get from SQL*Loader. But for QAD I'd probably let you off with it.
    You missed out one obvious alternative: using Java to turn the contents of an XML file into a CLOB and inserting it into a table which is read by a PL/SQL procedure that parses the XML records and insert the retrieved data into a table.
    Stay lucky, APC

  • Can I use Bridge to export image data into a .txt file?

    I have a folder of images and I would like to export the File Name, Resolution, Dimensions and Color Mode for each file into one text file. Can I use Bridge to export image data into a .txt file?

    Hello
    You may try the following AppleScript script. It will ask you to choose a root folder where to start searching for *.map files and then create a CSV file named "out.csv" on desktop which you may import to Excel.
    set f to (choose folder with prompt "Choose the root folder to start searching")'s POSIX path
    if f ends with "/" then set f to f's text 1 thru -2
    do shell script "/usr/bin/perl -CSDA -w <<'EOF' - " & f's quoted form & " > ~/Desktop/out.csv
    use strict;
    use open IN => ':crlf';
    chdir $ARGV[0] or die qq($!);
    local $/ = qq(\\0);
    my @ff = map {chomp; $_} qx(find . -type f -iname '*.map' -print0);
    local $/ = qq(\\n);
    #     CSV spec
    #     - record separator is CRLF
    #     - field separator is comma
    #     - every field is quoted
    #     - text encoding is UTF-8
    local $\\ = qq(\\015\\012);    # CRLF
    local $, = qq(,);            # COMMA
    # print column header row
    my @dd = ('column 1', 'column 2', 'column 3', 'column 4', 'column 5', 'column 6');
    print map { s/\"/\"\"/og; qq(\").$_.qq(\"); } @dd;
    # print data row per each file
    while (@ff) {
        my $f = shift @ff;    # file path
        if ( ! open(IN, '<', $f) ) {
            warn qq(Failed to open $f: $!);
            next;
        $f =~ s%^.*/%%og;    # file name
        @dd = ('', $f, '', '', '', '');
        while (<IN>) {
            chomp;
            $dd[0] = \"$2/$1/$3\" if m%Link Time\\s+=\\s+([0-9]{2})/([0-9]{2})/([0-9]{4})%o;
            ($dd[2] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of CODE\\s/o;
            ($dd[3] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of DATA\\s/o;
            ($dd[4] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of XDATA\\s/o;
            ($dd[5] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of FARCODE\\s/o;
            last unless grep { /^$/ } @dd;
        close IN;
        print map { s/\"/\"\"/og; qq(\").$_.qq(\"); } @dd;
    EOF
    Hope this may help,
    H

  • How to store the datas in a .txt file in to a JTable in Java Swing

    Hi sir,
    Here i want to know how to store the data's of a .txt file
    in to a JTable in java swing.
    Where here the .txt file like for eg,spooler.txt is in the server and from there it will come to my client machine what i have to do is to take that .txt file and store the datas of the .txt file
    in a JTable.This is what i want.So pls. do help and provide the code as well.I will be thankful.Since i am involved in a project which involves this it is Urgent.
    Thanx,
    m.ananthu

    You can't just display data from a text file in a JTable. You have you understand the structure of the data so that you can parse the data and create a table model that can access the data in a row/column format. Here is an example of a simple program that does this:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=315172

  • How continuously write data to a txt file

    hello, 
    first of all, sorry for bad English, but I have a problem to continuously write data to the txt file.... I have one 2D array with values of some function and based on 2 sliders (values of the sliders) i want to interpolate value using bilinear method... and after that value of the sliders, interpolated value, and value of the nearest points i wish to write to txt file ... for every 2-3 seconds perhaps it would be ideal to be formated as :: 
    x   y   f     f1   f2   f3   f4
    but... first i have problem with writing data, because every time it deletes old data and just write new one and it's not horizontal... I'm very very new at this (it is obvious) and any help will be very appreciative  
    thanks  
    Solved!
    Go to Solution.
    Attachments:
    Proba.vi ‏21 KB

    Hi there,
    May I suggest you start with the LabVIEW tutorial?  Or perhaps this one?
    I say that because 1) you said you're new at this, and these tutorials are great for getting started; and 2) you don't seem to understand the concept of dataflow.
    A structure, such as a loop or subVI or function, cannot start executing until it has all of its inputs available.  Therefore, the loop which contains your file write (bottom loop) cannot execute until your top loop is done executing, because it depends on inputs from your top loop and those inputs aren't available until the top loop is finished.  Thus, your file will contain only the data from your final top loop execution.  You might be thinking that your loops are executing in parallel.  They are not.  Your file loop is executing after your data loop has finished...that is to say, your file loop executes exactly once, after you press your stop button.
    You can do two things here to fix that:
    1.  You can move your file write into the top (data) loop. (probably easier for now)
    2.  You can use a queue to transfer the data from your top (data) loop into your bottom (file write) loop. (more complex, but a better idea in the long run)
    One other thing.  Move the "open file" function outside the loop.  Opening and closing the file in each loop iteration will cause problems.  Open the file once.  Write to it in each loop iteration.  Close it when you're done.  Like this:
    Note that this is not complete code...you need to provide the data to write.  This is just to show you how to set up a continuous file write.
    Ok, start with the tutorials and we'll go from there. 

  • What is the 'quickest' way to read char data from a txt file

    Hello,
    What is the 'quickest' way to read character data from a txt file stored on the phone to be displayed into the screen?
    Regards

    To be even a bit more constructive...
    Since J2me does not have a BufferedInputStream, it will help to implement it yourself. It's much faster since you read large blocks at ones in stread of seperate chars.
    something line this lets you read lines very fast:
      while ( bytesread < filesize ) {
             length = configfile.read( buff, 0, buff.length );
             // append buffer to temp String
             if ( length < buff.length ) {
                byte[]  buf  = new byte[length];
                System.arraycopy( buff, 0, buf, 0, length );
                tmp.append( new String( buf ) );
             } else {
                tmp.append( new String( buff ) );
             // look in tmp string for \r\n
             idx1 = tmp.toString().indexOf( "\r\n" );
             while ( idx1 >= 0 ) {
                //if found, split into line and rest of tmp
                line = tmp.toString().substring( 0, idx1 );
             /// ... do with it whatever you want ... ////
                tmp = new StringBuffer( tmp.toString().substring( idx1 + 2 ) );
                idx1 = tmp.toString().indexOf( "\r\n" );
             bytesread += length;
          }

  • Merging many XML files in diff directories

    I need to create a java program to merge many XML files in diff directories.
    Is there any standard code to do this?

    I need to create a java program to merge many XML
    files in diff directories.
    Is there any standard code to do this?Hi,
    For a document to be well formed or a valid XML document it should have only 1 root element containing other elements.
    So in case you want to merge different documents you need to create a new root element and append the child nodes of the different XML documents you want to merge excluding the first processing instruction containing the XML version and encoding.
    If you are sure that these XML that you are talking about are well formed then you can achieve this by simple File I/O. create a file create write the root element and then one by one copy the contents of other xml files except the first entity if any. Finally write the closing tag of the root element and you are done.
    Regards,
    Rajagopal

  • How to skip footer details when loading data from a .txt file

    Hello experts,
    i have to import data from a txt file into my database. I have skipped my header info by using SKIP but how can i ignore my footer details.
    Thanks

    Reply on your other thread:
    Processing txt file for a required format

  • JMF Play files in a sequence one after another

    Hi
    i developed a JMF based player for playing more than one files in a sequence one after another.
    problem is that it playes all files at same time.
    it should run 2nd file when one file is completed.

    I think time period or state of media will be helpful

  • Why am I getting an error when I place two OAM files one after the other in different pages?

    Why am I getting an error when I place two OAM files one after the other in different pages? They do not load or play correctly.  They are both configured to play automatically with a .125 second delay and both have a white rectangle "poster" over for a hidden effect.

    Thanks for the idea, Scott! I initially tried your idea, but my OAM files were still not loading correctly.  I tried other combinations of OAM files, and it seems to work fine.
    Back to my original OAM files: I made sure that my elements in my Edge Animate project had different names. I originally copied parts of some elements from one to another, and I think it was confusing to DPS to read it. 

  • Data merge says source file is incompatible

    In InDesign 1 I knew that I had to convert Excel files to .csv files in order to merge the data into an idd file. Never understood why but it worked. When I do that with CS3 I get an error message saying that the file is empty or an incompatible file type. The original xls file merges into a Word doc perfectly. There are 2048 rows of data in the Excel file.
    Any suggestions?
    I'm using CS3 on an intel iMac running OS 10.4.11 with two gig of ram.

    OK, I split the file into two versions, domestic and international by copying and pasting the data and inserting and retyping the header row, and combined the data from "address 2" into "address 1" and deleted the "address 2" column. That made all the records have data in all fields in all six columns. ID didn't like.
    Then I went through and fixed several dozen instances where the 5-digit zip codes had a hyphen after them, like "91007-". No help.
    Then I noticed some fields had spaces before the first letter of the first name, so I deleted those spaces and checked the other columns. No change.
    Then I changed the font from Verdana to Arial. No help.
    What else can I try?

  • How can I write waveform data to a txt file or an excel sheet?

    I want have a table that I can follow up in excel. In first column should be the timestamp (in ms or better in us), in the second column should be the value. I made an effort but it doesn´t work.
    Attachments:
    PWMReadWrite.vi ‏167 KB

    Yes, you must change block (Get Date/Time String.vi).
    You must write new subVI - this new VI convert date and time to the second [or ms or us].
    First choice is: time column will be count of second [the better ms or best us] since 12:00 a.m., January 1, 1904, Universal time[function "Get Date/Time In Seconds.vi"].
    Text file:
    3216546154,000 0.000000
    3216546154,050 0.062791
    3216546154,100 0.125333
    Second choice is: first record in TXT file will be time when test start and after will be table with time [ms or us] and value.
    Text file:
    Start time: Monday 30-th February 2005.
    0,000 0.000000
    0,050 0.062791
    0,100 0.125333
    Have a nice day.
    JCC
    P.S.: I recommend you creat header of result table to text file.
    Text file:
    time [ms] U [V]
    3216546154,000 0.000000
    3216546154,050 0.062791
    3216546154,100 0.125333

  • How to extract data from a .txt file & send it to a serial port automatically

    Hi all
    I'm a final yr B.Tech student. I am new to the entire LABVIEW thing. But i hear its really good. My dept. in collge has purchased labview & i'm tryng to use it
    As i'm new to labview , i need help plz
    " I want to open a .txt file (in my PC) & transmit all the contents of the file via serial (COM) port to an 89%! microcontroller. Also i want to read the feedback messages from the microcontroller thru the serial port & save it to the same file in the PC.All this must be done automatically. ie, no manual intervention after execution starts"
    Kindly help me as i'm stuck here & unable to proceed further with my project

    here is my 20min try without debugging (needs a rs232 and loopback connector )
    use the probe and highlight the dataflow to see how it works.
    as always:  there are many ways to solve your problem
    Greetings from Germany
    Henrik
    LV since v3.1
    “ground” is a convenient fantasy
    '˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'
    Attachments:
    read write file to RS232.vi ‏69 KB

Maybe you are looking for