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

RE: [Clip] DestroyDoc

Expand Messages
  • Larry Thomas
    Hi John and Harvey, I am just posting this clip to show what a person (me) can learn by exploring somebody else s ideas of doing things. I replied with There
    Message 1 of 9 , Aug 10, 2003
      Hi John and Harvey,

      I am just posting this clip to show what a person (me) can learn by
      exploring somebody else's ideas of doing things. I replied with "There is
      no way of doing wildcards in NoteTab that I know of.". Well, I have
      certainly learned better now. The previous clip did not do what you said
      you wanted to do because I could not think of a way to use wildcards on the
      open documents so I though that was the best that I was going to be able to
      do. Then yesterday Don Don Daugherty posted another reply to another post
      and he used the command ^!IfMatch in his reply. That put a bee in my
      bonnet and I started thinking really hard about it and you know, I found
      that I could use it to write a clip that does exactly what you wrote about
      on open documents in NoteTab.

      First the clip uses ^!Document Last to go to the last open document tab in
      the open documents. Next, the ^!IfMatch line tests the file name against
      your pattern which you enter into a wizard set up in it to see if the file
      name matches. It does not use wildcards the way you listed but it does use
      regular expressions which are similar to DOS wildcards. You can enter your
      examples of A483AR*.log or A483AR*.rpt as A483AR.*\.log or A483AR.*\.rpt
      which will get the result you are looking for. Then the clip will
      ^!DestroyDoc on the open document which will remove the document from the
      list of tabs and move the focus to the previous tab if the pattern is found
      or it will branch to ^!Document Prev which will move the focus to the
      previous document tab if the pattern does not match. Then the clip checks
      the document index position to see if it is on the first open document tab.
      If it is, it goes to the finish routine and checks the document to see if
      it should be deleted and deletes it or not and then quits. If it is not
      the first document tab, the clip loops back for the next open document and
      keeps looping until it reaches the first document tab and then processes it
      and quits.

      Here is the clip - Only 14 lines long:

      Just Modify/Join the two long lines and remove the long line markers and
      add it to your library to use it. I have tested it using ^!Close instead
      of ^!DestroyDoc and it works. I used ^!DestroyDoc with no parameters on
      individual open documents and it sends the documents to the recycle bin,
      removes them from the open tabs, and moves the tab focus back to the
      previous document. ^!Close does the same as ^!DestroyDoc but it does not
      send the document to the recycle bin so I thought that was good enough to
      use for testing purposes and when I used it, it workded the way I wanted it
      to.

      ______[Copy below this line]_______
      H="Test IfMatch"
      ;lrt@... e¿ê
      ;08/10/2003, 04:14:23 PM
      ^!SetScreenupdate 0
      ^!Document Last
      :Loop
      ;
      ;----------------------[begin long line]---------------------------
      ^!IfMatch "^?[Enter RegExp Pattern (Pattern.*\.Ext)=]"
      "^$GetFileName(^**)$" Next ELSE PrevDoc
      ;-----------------------[end long line]----------------------------
      ;
      ^!DestroyDoc
      ^!Goto Loop
      :PrevDoc
      ^!Document Prev
      ^!If ^$GetDocIndex$ = 1 Finish ELSE Next
      ^!Goto Loop
      :Finish
      ;
      ;----------------------[begin long line]---------------------------
      ^!IfMatch "^?[Enter RegExp Pattern (Pattern.*\.Ext)=]"
      "^$GetFileName(^**)$" Next ELSE Exit
      ;-----------------------[end long line]----------------------------
      ;
      ^!DestroyDoc
      _____[Copy above this line]______
      | right click over the clipbook |
      | and choose "Add from Clipboard" |
      ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

      My point here is that you helped me learn something new about NoteTab's
      programing that I did not know by asking your question. Thank you very
      much for the experience. This is something that I can use on clips that I
      am thinking about writing for my own personal use.

      Regards,

      Larry
      lrt@... e¿ê
    • Wright, John - Textron Financial
      Larry, I like it, it s very elegent. One problem, I m getting a syntax error on the Match statement. I m sure it must be something I m doing wrong. Maybe it s
      Message 2 of 9 , Aug 11, 2003
        Larry,
        I like it, it's very elegent. One problem, I'm getting a syntax error on the
        Match statement. I'm sure it must be something I'm doing wrong. Maybe it's
        what I'm entering into the wizzard, but I've tried every combination I can
        think of.
        I did join the two portions of the long lines before attempting to run it.

        -----Original Message-----
        From: Larry Thomas [mailto:larryt@...]
        Sent: Sunday, August 10, 2003 5:54 PM
        To: ntb-clips@yahoogroups.com
        Subject: RE: [Clip] DestroyDoc



        Hi John and Harvey,

        I am just posting this clip to show what a person (me) can learn by
        exploring somebody else's ideas of doing things. I replied with "There is
        no way of doing wildcards in NoteTab that I know of.". Well, I have
        certainly learned better now.
      • Larry Thomas
        ... You must use regular expressions for your patterns when entering patterns. In regular expressions, a period is a meta character and it is interpreted as
        Message 3 of 9 , Aug 11, 2003
          At 09:46 AM 8/11/03 -0400, you wrote:
          >Larry,
          >I like it, it's very elegent. One problem, I'm getting a syntax error on the
          >Match statement. I'm sure it must be something I'm doing wrong. Maybe it's
          >what I'm entering into the wizzard, but I've tried every combination I can
          >think of.
          >I did join the two portions of the long lines before attempting to run it.


          You must use regular expressions for your patterns when entering patterns.
          In regular expressions, a period is a meta character and it is interpreted
          as "any" character except for a newline <cr/lf> pair. An asterisk (*)
          means zero or more occurences of the previous character and a back slash
          (\) is an escape character which cause the pattern to treat the next
          character as a litteral character. Without the back slash, the period is
          treated as a meta character by the regexp search engine but with the back
          slash just before the period or any other meta character, the meta
          character is treated as just a plain text character. A \. os just a period
          and \* is just an asterisk. The exception to this rule are the special
          situations set for special characters (\n for newline, \s for a space, and
          \t for a tab).

          You can find help for using NoteTab's regexp patterns by going to Help/Help
          Topics/Reference Information/Dialog boxes/Regular Expressions.

          There is one other problem that I have found. When you set a pattern to
          find all files and recycle them, the clip will not stop without preessing
          and holding the Ctrl+Alt Keys. I fixed this by moving the line:

          ^!If ^$GetDocIndex$ = 1 Finish ELSE Next

          From just before the ^!Goto Loop line to just after the :Loop label. Now
          it works with all patterns.

          I have copied mine back from the email and rejoined the lines and I do not
          get a syntax error. You need to use regular expressions in the wizard, not
          DOS wildcards.


          Regards,

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