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

15961Re: [Clip] Brooding about ^$GetDocMatchAll

Expand Messages
  • Sheri
    Jan 14, 2007
      Hi Flo,

      Some suggestions FWIW,

      - Switch to Alec's code that makes use of the captured subpattern in
      lookaheads and lookbehinds and replaces unneeded text with "", its
      just as accurate and orders of magnitude faster than the one that
      Finds and appends. Its in his message addressing Eric.

      - When you open and close a file from your clip, never assume you are
      back in your original document. You should save the original position
      with ^$GetDocIndex$ before leaving the document and restore it
      afterwards with ^!SetDocIndex

      Actually your ^!Close ^%Listfile% Discard

      doesn't work if there are spaces in the file name held by ^%Listfile%.
      ^!Close Discard is sufficient to close the current document; if you
      want to name it, it needs quotes around the filename portion, e.g.,
      ^!Close "^%Listfile%" Discard

      - Avoid using ^!ClearVariables. ^!ClearVariables clears all variables,
      not just the ones set by your clip. It is useful to keep some
      variables around, e.g., if you didn't clear ^%Listfile% you could add
      it to your wizard so that it would default to last file selected, e.g.,

      ^!Set %Listfile%="^?{(T=O)Open file:=^%Listfile%}"

      Here's a clip you can run from the clipbar during clip-edit to help
      create individual ^!ClearVariable commands for each of your variables.
      You can highlight and copy the lines to the clipboard from the info
      box when you're ready.

      H="List Variable Names"
      ^!SetListdelimiter ^P
      ^!Info ;2007-01-14 created by Sheri Pierce
      ^!Jump Text_Start
      ^!SetListdelimiter ^P^^!ClearVariable
      ;next is one long line
      ^!Info
      ^$StrSort("^!ClearVariable^$GetDocMatchAll("\b[^^]%.+?%";0)$";No;Yes;Yes)$
      ;end of clip

      - You will want to be very careful not to get an extra vertical bar
      into your list of alternate keywords from the ^%Listfile% file. Make
      sure there are no empty lines in the file and that the file doesn't
      end with \r\n before replacing \r\n with |

      If you do get an extra vertical bar in there, it considers the empty
      string to be a keyword. This can actually match the empty space
      between every letter of the whole document.

      - You might want to consider allowing mulitple terms to be entered in
      your wizard, using a separate file seems inconvient to me.

      Regards,
      Sheri
    • Show all 35 messages in this topic