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

11986Re: Disk replace in Standard

Expand Messages
  • John Zeman
    Jun 12, 2004
    • 0 Attachment
      --- In ntb-clips@yahoogroups.com, Jeff Scism <scismgenie@a...> wrote:
      > I am doing global replacements in NoteTab Standard.
      >
      > I need to remove all HTML "Head" coding in all htm files in a
      directory,
      > and its subfolders, (I already know how to get the replace to do
      > globals with Control+d)
      >
      > How do I get the process (via a clip) to automatically seek out
      > </head>, and delete everything before it, replacing it with the
      coding
      > that will standardize all pages?
      >
      > (and is there a way to toggle off word wrap in all documents in a
      sub
      > directory? I have done it before using the Keyboard command as a
      part
      > of the clip on OPEN docs.)
      >
      >
      > --
      > ``
      >
      > Jeffery G. Scism. IBSSG


      Recently I'd made a clip similar to what search disk does so it
      didn't take much modification to do what you want.

      I took what you said literally Jeff, meaning you wish to delete
      everything AHEAD of </head> in all documents. If you instead meant
      to delete everything ahead of </head> including </head> then you
      should change the

      ^!Jump SELECT_START

      Line to:

      ^!Jump SELECT_END

      Put the new code to be used in a new empty text file. In my example
      below I used:

      C:\Mine\Upload\home\newcode.tmp

      Also, the line in the clip that would normally save each page after
      it was processed is commented out. So if the clip does not do what
      you want, you won't lose the originals (unless of course you do save
      them).

      Change the value assigned to the %PATH% variable from

      C:\Mine\Upload\home\

      to where your files are, and if necessary, the file types from *.htm*
      to what you want.

      Finally, I do not know why this would not work on Standard, but I do
      not use Standard so I cannot say that for sure.

      I'll leave the word wrap part of your questions for someone else to
      answer, there's a nasty storm moving in fast so I have to shut things
      down.

      John

      ; begin clip =======================

      ~temp3

      ; SET FULL PATH TO SEARCH (PRECEDE WITH A +
      ; TO INCLUDE SUBDIRECTORIES
      ^!Set %PATH%=C:\Mine\Upload\home\
      ; SET TYPE OF FILE (WILDCARDS OK
      ^!Set %TYPE%=*.htm*

      ; THE NEW IMPROVED CODE THAT WILL BE USED AS THE
      ; REPLACEMENT CODE IS STORED IN THE FOLLOWING
      ; FILE. OPEN IT AND ASSIGN ITS CONTENTS TO A VAR
      ^!OpenReadOnly "C:\Mine\Upload\home\newcode.tmp"
      ^!Set %NEWCODE%=^$GetText$
      ^!Close Discard

      ^!SetWizardTitle Search in:
      ^!SetWizardLabel ^%PATH%
      ^!Set %CNT%=0
      ^!SetArray %FILES%=^$GetFiles("^%PATH%";^%TYPE%;;Name)$
      ^!StatusShow Please Wait.Searching files for </head>
      ^!SetScreenUpdate Off

      :Loop
      ^!Inc %CNT%
      ^!Open ^%FILES^%CNT%%
      ^!Find "</head>" TIWS
      ^!IfError CloseIt
      ^!Jump SELECT_START
      ; SELECT EVERYTHING PRECEDING </HEAD>
      ^!SelectTo 1:1
      ; NOW REPLACE WHAT IS SELECTED WITH NEW CODE
      ^!InsertHtml ^%NEWCODE%

      ; save the file
      ;^!Save

      ^!If "^%CNT%" < "^%FILES0%" Loop
      ^!GoTo End

      :CloseIt
      ; IF THE FILE WAS ALREADY OPEN AND MODIFIED DO NOT CLOSE IT
      ^!If "^$IsModified$" = "1" skip_1
      ^!Close ^%FILES^%CNT%%
      ^!If "^%CNT%" < "^%FILES0%" Loop
    • Show all 11 messages in this topic