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

12253Re: Changing numbers to hyperlinks in 1647 HTML pages

Expand Messages
  • John Zeman
    Aug 1, 2004
    • 0 Attachment
      --- In ntb-clips@yahoogroups.com, Jeff Scism <scismgenie@a...> wrote:
      > Each of 1647 HTML pages needs to link to the proper "parent"
      document.
      >
      > The pages are in the SAME directory, and are numbered 01-1647.htm
      with a
      > few of them suffixed with the lower case a,b,c, etc.
      >
      > The line I need to change is formatted as follows:
      >
      > (Son of No. 1) through (Son of No. 1646)
      >
      > The goal is to via directory replacement clip, to change each
      NUMBER
      > that follows "No. " into a hyperlink
      > This clip works for that:
      > ^!INSERT <A HREF="^&.htm">^&</A>
      >
      >
      > How do I get the program to find the "No. " in each document and
      select
      > the word AFTER it for the Insert conversion to a link?
      >
      > I am already using the DIRSTUFF clips to do the sequential changes
      on
      > some other portions of webpages, but I am looking for the process
      of
      > selecting the next word (which is a sequentially numbered
      reference),
      > for the Looped Clip running.
      >
      > FLOW CHART:
      >
      > Select directory (this I can do)
      > Find in all Documents "No. " (this I can do)
      > SELECT the word AFTER "No. " to the clipboard
      > ^!INSERT <A HREF="^&.htm">^&</A> (this I can do)
      > Close and save silently
      > loop to Next document in the directory (this I can do)
      >
      >
      > Jeff Scism
      >
      > --
      > ~~



      Well if you really want to be gutsy and you are using NoteTab Pro or
      Std, you might be able to do this without a clip. By using the built
      in Search/Search Disk tool. I use Search Disk a lot, it saves me
      countless hours in situations like this.

      Before trying this however, you'd better do a LOT of testing of this
      on dummy files. This also assumes you will want to wrap ALL
      occurrences of numbers contained within the following text:

      Son of No. ###

      where ### represents any number of or sequences of digits.

      with HTML anchor tags. And to do this in all the HTML documents
      within a folder.

      Now if that doesn't scare you away, here's how you can do it with
      Search Disk. First press CTRL+D to bring up the Search Disk Dialog
      box. Click on the REPLACE tab and make sure the "Reg Expr." box is
      NOT checked. Then click the CANCEL button to close Search Disk.
      Next in a new unsaved document, type the following two lines exactly
      as they are below:

      Son of No\. {[0-9]+}

      <a href="\1.htm">\1</a>

      Then select the bottom line (<a href="\1.htm">\1</a>) and copy it to
      the Windows clipboard. Next select the top line (Son of No\. {[0-9]
      +}) and press CTRL+D to bring up the Search Disk dialog box again.
      With that open click the replace tab and you should see your selected
      text in the "Find What" box. Click in the "Replace With" box and
      paste in <a href="\1.htm">\1</a> that you had previously copied to
      the Windows clipboard by pressing CTRL+V.

      Next (still in Search Disk) in the "Search Directory Options"
      section, browse to the folder that contains the files you want to
      process. After you have selected that folder and pressed OK, make
      sure the "Search Directory Options" path looks something like this:

      C:\my tests\temp\*.htm*

      where the path ends with *.htm*

      Ok, you're just about ready to do this. The last steps are to
      optionally check the "Backup" box to make backups of all the files
      that will be changed, and to uncheck the "Subdirectories" box, and
      then finally, to check the "Reg Expr." box.

      Take a deep breath then press the START button and sit back and watch
      what happens. If you did everything correctly after a minute or two
      (depending upon the speed of your computer) you should see a NoteTab
      box pop up telling you how many changes were made to how many files.

      As I said though, I'd do a LOT of testing with this on dummy files
      before trying it on the real ones.

      Good luck,

      John

      PS Alternatly, you can use a clip to find the number to be replaced
      by searching for "
      Son of No\. {[0-9]+}" as long as you have the RegExp option checked.
    • Show all 12 messages in this topic