Loading ...
Sorry, an error occurred while loading the content.
 

Merging chapters of a book

Expand Messages
  • John Shotsky
    I have a folder with many files in it. Some of the files are chapters of a book. I would like to create a new document that would have each of the chapters
    Message 1 of 5 , Dec 1 11:17 AM
      I have a folder with many files in it. Some of the files are chapters of a book. I would like to create a new document
      that would have each of the chapters inserted in a specific order, such as page number order. I can create one document
      that lists the exact chapter names and file types that are to be merged. The names would be in the order needed. This
      file would be in the same folder as the chapters, to minimize the need to find folders.

      The new clip needs to start with the list open, and would then read the list, get the contents of each file in order,
      and place them into a new file, let's call it 'final.txt'. At the end of this operation, I would compare the list with
      the results to make sure none were missed.

      Anyone care to take this on? The chapters for the test could simply be named 'one.txt', two.txt', etc. and have only one
      word inside � one, two, etc. Then, I would be able to rearrange the order of the list and repeat the command to make
      sure the order is followed.

      Sample chapters:
      one.txt (one)
      two.txt (two)
      three.txt (three)
      four.txt (four)

      The list:
      one.txt
      two.txt
      three.txt
      four.txt

      Thanks!
      John


      [Non-text portions of this message have been removed]
    • Axel Berger
      ... Of course Clips can do that, but far easier is: copy one.txt+two.txt+three.txt+four.txt final.txt Do a dir /b /on *.txt combine.bat open in NoteTab,
      Message 2 of 5 , Dec 1 11:29 AM
        John Shotsky wrote:
        > Then, I would be able to rearrange the order of the list and
        > repeat the command to make sure the order is followed.

        Of course Clips can do that, but far easier is:

        copy one.txt+two.txt+three.txt+four.txt final.txt

        Do a

        dir /b /on *.txt > combine.bat

        open in NoteTab, rearrange as needed, and make a simple clip to
        transform the list to the batch command line.

        ^!Replace "^P" >> "+" WASTI

        and you're 80 % there.

        Axel
      • flo.gehrke
        ... John, I resolved similar tasks with OTL. It goes like this... 1. Save each chapter in a single TXT file containing a heading H= that could serve as a
        Message 3 of 5 , Dec 1 3:36 PM
          --- In ntb-clips@yahoogroups.com, "John Shotsky" <jshotsky@...> wrote:
          >
          > I have a folder with many files in it. Some of the files are
          > chapters of a book. I would like to create a new document
          > that would have each of the chapters inserted in a specific order,
          > such as page number order...

          John,

          I resolved similar tasks with OTL. It goes like this...

          1. Save each chapter in a single TXT file containing a heading 'H=' that could serve as a code on which you can sort all chapters. For example, save three little files containing...

          (file1.txt)

          H="bbb"

          This is chapter 'bbb'.

          (file2.txt)

          H="ccc"

          This is chapter 'ccc'.

          (file3.txt)

          H="aaa"

          This is chapter 'aaa'.

          2. Open an empty document and run a clip like...

          ^!InsertText = V4 Outline MultiLine NoSorting TabWidth=30^P^P
          ^!InsertText ^$GetFileText(^$GetDocumentPath$file1.txt)$^P^P
          ^!InsertText ^$GetFileText(^$GetDocumentPath$file2.txt)$^P^P
          ^!InsertText ^$GetFileText(^$GetDocumentPath$file3.txt)

          3. Save this document as 'ALLCHAPTERS.TXT' (or '.OTL') -- NT will treat it as an OTL anyway when opening it next time.

          4. Open ALLCHAPTERS.TXT, sort the headings, and save the file.

          5. Open another empty document and run the clip...

          ^$GetFileText(^$GetDocumentPath$ALLCHAPTERS.TXT)$

          This will provide a combination of all chapters sorted on the code in the headings.

          6. Run another clip which will remove all OTL-specific code in order to get a clean version of your text.

          Regards,
          Flo
        • Sheri
          There is also ^!InsertFile command, you could just make a clip that inserts them one after the other into the current document. Possibly in a loop. Regards,
          Message 4 of 5 , Dec 1 6:06 PM
            There is also ^!InsertFile command, you could just make a clip that inserts them one after the other into the current document. Possibly in a loop.

            Regards,
            Sheri
          • John Shotsky
            Yes, that s what I ended up doing. Works fine. Regards, John RecipeTools Web Site: http://recipetools.gotdns.com/ From:
            Message 5 of 5 , Dec 1 6:10 PM
              Yes, that's what I ended up doing. Works fine.

              Regards,
              John
              RecipeTools Web Site: <http://recipetools.gotdns.com/> http://recipetools.gotdns.com/

              From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Sheri
              Sent: Thursday, December 01, 2011 18:07
              To: ntb-clips@yahoogroups.com
              Subject: [Clip] Re: Merging chapters of a book


              There is also ^!InsertFile command, you could just make a clip that inserts them one after the other into the current
              document. Possibly in a loop.

              Regards,
              Sheri



              [Non-text portions of this message have been removed]
            Your message has been successfully submitted and would be delivered to recipients shortly.