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

RE: [Clip] Re: Help on merging files

Expand Messages
  • John Shotsky
    Yes, that was pretty much my current scheme. I ve learned that the GetFileText is ignorant of UTF-8, though, so it boogers up html files. I found another way
    Message 1 of 4 , Jul 23, 2012
    • 0 Attachment
      Yes, that was pretty much my current scheme. I've learned that the 'GetFileText' is ignorant of UTF-8, though, so it
      boogers up html files. I found another way around that, which creates one big html file to start with, then it is
      processed for utf-8 before NoteTab is allowed to open it as Ascii. That seems to work. In case anyone mentions that you
      can use a UTF version, that doesn't fix the problem, because the real problem is that these characters cannot be
      represented in Ascii/Ansi. Things like the single-character versions of 1/8, 1/3, 1/5, etc, don't have representation,
      only 1/4, 1/2 and 3/4 do. So, my code looks for these characters, and converts them to their three character equivalants
      before NoteTab sees the file. The eliminates that irritating question mark that shows up in NoteTab for characters it
      can't display. So, all is good again.

      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 Eb
      Sent: Monday, July 23, 2012 18:15
      To: ntb-clips@yahoogroups.com
      Subject: [Clip] Re: Help on merging files


      Well, you're gonna hafta loop, but it ain't that bad:

      H="Concat files"
      ;add source and destination info
      ^!Set %dest_file%=...
      ^!SetArray %sourcefiles%=^$GetFiles("path";*.ext)$
      ^!Set %i%=0
      :LOOP
      ^!Inc %i%
      ^!Append "^%dest_file%" ^$GetFileText("^%sourcefiles^%i%%")$^%NL%
      ^!If ^%i%<^%sourcefiles0% LOOP

      Cheers,

      Eb

      --- In ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com> , "John Shotsky" <jshotsky@...> wrote:
      >
      > Often, I find that there are a group of files in a folder that I want to merge into a single file. I name the new file
      > the same as the folder in which the files are found. I have a method to locate the folder, and to present the files
      with
      > checkboxes all checked, permitting the user to uncheck any that are to be omitted. Then, I have a very complicated
      > method to concatenate those files into a single file, which seems to me to be waaay overkill. I'm wondering if there
      is
      > a simpler way?
      >
      > I have a variable named %AllFiles% that contains the names of all the files to be merged, including full path. In this
      > case, they are individual html files that I want to convert to a single web page file. I'm using the 'Append' command
      > and looping through, one by one and merging each file. Is there a way to use the list of files to simplify this
      process?
      > How about InsertText? Would that mean that each file wouldn't have to be opened and closed explicitly? Could a single
      > loop just grab the text from each file and put it into the new doc? Would it work better to copy the text to the
      > clipboard, then just paste the clipboard at the end?
      >
      > What I have does work, but it feels like spaghetti code rather than a straightforward, efficient method. Any thoughts?
      > Thanks!
      > John Shotsky
      >
      >
      >
      >
      > [Non-text portions of this message have been removed]
      >



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