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

Re: [Clip] Simple ^!Replace for smartquotes

Expand Messages
  • Larry Thomas
    Hi Todd, ... I am not sure that I understand your code but I will take a crack at it. Try the following: H= Reset SmartQuotes ;Removes curly quotes with HTML
    Message 1 of 4 , Sep 15, 2003
      Hi Todd,

      At 10:18 PM 9/15/03 -0000, you wrote:
      >with 10,000+ messages here, it's difficult to locate a decent (read
      >it: quick) answer to a simple question. So hopefully someone can do
      >so without too much trouble?
      >
      >I'm trying to write a clip that replaces "SmartQuotes" and
      >apostrophes on an HTML page with the correct HTML code: either
      >“ and ” or " I don't really care. I thought I had
      >something, but it doesn't go through my entire document when I try
      >it. I've added the following simple commands:
      >
      >H="Reset SmartQuotes"
      >;Removes curly quotes with HTML code
      >^!Replace " " TWA
      >^!Replace " " TWA
      >
      >H="Reset Apostrophes"
      >;Replaces so-called "smart apostrophes" with HTML Code.
      >^!Replace ` ’ TWA
      >^!Replace ' ’ TWA
      >
      >
      >My basic understanding thinks this should work.
      >How niave am I?
      >:^) TIA

      I am not sure that I understand your code but I will take a crack at it.
      Try the following:

      H="Reset SmartQuotes"
      ;Removes curly quotes with HTML code
      ^!Jump 1
      :Loop
      ^!Replace “ " TISA
      ^!IfError EXIT ELSE NEXT
      ^!Replace ” " TISA
      ^!Goto Loop

      H="Reset Apostrophes"
      ;Replaces so-called "smart apostrophes" with HTML Code.
      ^!Jump 1
      :Loop
      ^!Replace ‘ ’ TISA
      ^!IfError EXIT ELSE NEXT
      ^!Replace ’ ’ TISA
      ^!Goto Loop

      The W option will force the replace command to find the first occurrence
      over and over again. And you should use a loop to find and replace all
      occurences.

      Regards,

      Larry
      lrt@... e¿ê
    • Larry Thomas
      Hi Todd, ... My goodness!! I did not even stop to think. It does not matter if it searches over and over again because it replaces each occurence with
      Message 2 of 4 , Sep 15, 2003
        Hi Todd,

        I just wrote:

        >The W option will force the replace command to find the first occurrence
        >over and over again. And you should use a loop to find and replace all
        >occurences.

        My goodness!! I did not even stop to think. It does not matter if it
        searches over and over again because it replaces each occurence with
        something else which means that the W option can be used in this clip after
        all. Dummy me.

        Regards,

        Larry
        lrt@... e¿ê
      • Todd Haugland
        ... at it. ... occurrence ... replace all ... Ah, I was thinking the W feature would take care of the looping but I guess not. ... ... well, now THAT was
        Message 3 of 4 , Sep 15, 2003
          --- In ntb-clips@yahoogroups.com, Larry Thomas <larryt@c...> wrote:
          >
          > Hi Todd,
          >
          > I am not sure that I understand your code but I will take a crack
          at it.

          > The W option will force the replace command to find the first
          occurrence
          > over and over again. And you should use a loop to find and
          replace all
          > occurences.
          >

          Ah, I was thinking the "W" feature would take care of the "looping"
          but I guess not.
          ------
          ... well, now THAT was fun!
          I tried it. Don't try it. It runs REPLACE.EXE in Windows ... Over,
          and over, and over, and over .... oops.

          Hmmm, that's the syntax indicated by Fookes.... soooo what else can
          I do?

          tch
        • Larry Thomas
          Hi Todd, ... I have an old version of DOS which has Replace.exe in the C: DOS folder. It is not in my PATH statement and it is not installed in the
          Message 4 of 4 , Sep 15, 2003
            Hi Todd,

            At 03:06 AM 9/16/03 -0000, you wrote:
            >... well, now THAT was fun!
            >I tried it. Don't try it. It runs REPLACE.EXE in Windows ... Over,
            >and over, and over, and over .... oops.
            >
            >Hmmm, that's the syntax indicated by Fookes.... soooo what else can
            >I do?

            I have an old version of DOS which has Replace.exe in the C:\DOS folder.
            It is not in my PATH statement and it is not installed in the applications
            section of the Windows registry. The result is that it does not run when I
            run the ^!Replace command. Only the clip parser version in NoteTab acts on
            this command.

            You have shown me something that I had not previously though about. The
            normal function of the clip parser is to run programs in windows if you
            enter the program name after the command identifier (^!). An example is to
            run the Windows calculator, you enter ^!Calc.exe into a clip and every time
            you run the clip, the calculator will be launched. I never realized that a
            command that had the same name as a NoteTab command would be launched
            rather than using NoteTab's clip parser commands. Eric, do you have any
            comments about this????

            I am not totally sure what you could do but I would suggest relocating the
            Replace.exe file to a different folder that is not in your PATH statement.
            If you do not have a PATH statement set up in your Autoexec.bat file (the
            newer versions of Windows does not require that you have a PATH statement
            or anything else in the autoexec.bat file), you might try renaming the
            Replace.exe file to something else. Example: Replace01.exr. This will
            allow you to still use it by using the new name in DOS when you want to run
            it and NoteTab will not activate it because it will not find it.

            Regards,

            Larry
            lrt@... e¿ê
          Your message has been successfully submitted and would be delivered to recipients shortly.