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

Re: [Clip] Finding text

Expand Messages
  • Larry Thomas
    ... This clip does the job. ______[Copy below this line]_______ H= Find two words ;lrt@nospamplease.net e¿ê ;06/05/2004, 10:45:48 PM ^!Set
    Message 1 of 7 , Jun 5, 2004
    • 0 Attachment
      At 10:35 PM 6/5/04 -0400, you wrote:
      >I am trying to write a clip that will find a word, then ask if the user
      >wants to look for another occurrence of that same word; if yes, it would
      >look for the next occurrence, otherwise it would go to the next word (I
      >have several other words I also need to add to the clip). What I have is
      >below and it doesn't seem to work. Any suggestions?
      >
      ><begin clip>
      >^!ClearVariables
      >^!Set %row%=^$GetRow$
      >^!Set %col%=^$GetCol$
      >^!Goto first
      >
      >:first
      >^!Find "would" C
      >^!Continue [Search for next occurrence?]
      >^!IfTrue Goto first ELSE Goto second
      >
      >:second
      >^!SetCursor ^%Row%:^%Col%
      >^!Find "is" C
      >^!Continue [Search for next occurrence?]
      >^!IfTrue Goto second ELSE Goto end
      ><end clip>
      >
      >Thanks!
      >
      >Lee

      This clip does the job.

      ______[Copy below this line]_______
      H="Find two words"
      ;lrt@... e¿ê
      ;06/05/2004, 10:45:48 PM
      ^!Set %cursor%=^$GetRow$:^$GetCol$

      :first
      ^!Find "would" CS
      ^!IfError Skip
      ^!Skip Search for next occurrence of "would"?
      ^!Goto second
      ^!Goto first

      :second
      ^!SetCursor ^%cursor%
      :third
      ^!Find "is" CS
      ^!IfError Skip
      ^!Skip Search for next occurrence of "is"?
      ^!Goto Exit
      ^!Goto third
      _____[Copy above this line]______
      | right click over the clipbook |
      | and choose "Add from Clipboard" |
      ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

      Here is the same clip with a description of what each line of code does.

      ^!Set %cursor%=^$GetRow$:^$GetCol$
      ;This saves the current cursor postion so that the second word can be
      ;searched for from this point.

      :first
      ^!Find "would" CS
      ;This seaches for the word "would" and does not give a message if the
      ;word is not found.

      ^!IfError Skip
      ;This tests to see if anything was found. If not, it skips the prompt
      ;in the next line.

      ^!Skip Search for next occurrence of "would"?
      ;This line asks you if you want to search for "would" again. If you
      ;answer yes, it skips the branch to seach for "is" and branches back
      ;to the label "first" to do another seach for "would". Otherwise,
      ;it branches to the label "second" for the second word.

      ^!Goto second
      ;This branches to the label "second"

      ^!Goto first
      ;This loops back to the label "first"

      :second
      ^!SetCursor ^%cursor%
      ;This repositions the cursor back to where it was so that you can\
      ;search for the word "is" starting from that position.

      :third
      ;This label is a loop target to prevent the clip from repositioning
      ;the cursor back to the first position everytime the word "is" is
      ;found. Ohterwise, you would never be able to find the second and
      ;subsequent occurrences of the word. It would just keep finding
      ;the some word over and over again.

      ^!Find "is" CS
      ;This seaches for the word "is" and does not give a message if the
      ;word is not found.

      ^!IfError Skip
      ;This tests to see if anything was found. If not, it skips the prompt
      ;in the next line.

      ^!Skip Search for next occurrence of "is"?
      ;This line asks you if you want to search for "is" again. If you
      ;answer yes, it skips the branch to exit the clip and branches back
      ;to the label "third" to do another seach for "is". Otherwise,
      ;it loops back to the label "third" to seach for another occurrence
      ;of the second word "is".

      ^!Goto Exit
      ;This line causes the clip to quit running if nothing is found, or if
      ;you choose to not seach for another occurrence of the word "is".

      ^!Goto third
      ;This line causes the clip to loop back for another search for the
      ;the word "is".

      End of commented clip:
      =====================


      Regards,

      Larry
      lrt@... e¿ê
    • Larry Thomas
      Oops! This line from my previous post: ^!Skip Search for next occurrence of is ? ;This line asks you if you want to search for is again. If you ;answer
      Message 2 of 7 , Jun 5, 2004
      • 0 Attachment
        Oops! This line from my previous post:

        ^!Skip Search for next occurrence of "is"?
        ;This line asks you if you want to search for "is" again. If you
        ;answer yes, it skips the branch to exit the clip and branches back
        ;to the label "third" to do another seach for "is". Otherwise,
        ;it loops back to the label "third" to seach for another occurrence
        ;of the second word "is".

        Should read:

        ^!Skip Search for next occurrence of "is"?
        ;This line asks you if you want to search for "is" again. If you
        ;answer yes, it skips the branch to exit the clip and branches back
        ;to the label "third" to do another seach for "is". Otherwise,
        ;it falls through to the next line of code which causes the clip
        ;to stop running.

        Sorry for the confusion,

        Regards,

        Larry
        lrt@... e¿ê
      • Larry Thomas
        Hi Lee, I am just sending this copy of my clip to demonstrate how you can use labels to make things easier to follow. I changed the labels to names to try to
        Message 3 of 7 , Jun 5, 2004
        • 0 Attachment
          Hi Lee,

          I am just sending this copy of my clip to demonstrate how you can use
          labels to make things easier to follow. I changed the labels to names to
          try to show what they do.

          ______[Copy below this line]_______
          H="Find two words"
          ;lrt@... e¿ê
          ;06/05/2004, 10:45:48 PM
          ^!Set %cursor%=^$GetRow$:^$GetCol$

          :would
          ^!Find "would" CS
          ^!IfError Skip
          ^!Skip Search for next occurrence of "would"?
          ^!Goto reset-cursor
          ^!Goto would

          :reset-cursor
          ^!SetCursor ^%cursor%

          :is
          ^!Find "is" CS
          ^!IfError Skip
          ^!Skip Search for next occurrence of "is"?
          ^!Goto Exit
          ^!Goto is
          _____[Copy above this line]______
          | right click over the clipbook |
          | and choose "Add from Clipboard" |
          ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

          Regards,

          Larry
          lrt@... e¿ê
        • Larry Thomas
          Hi Lee, This is an improved version of my clip that allows you to search for many words, not just one or two. You can modify this clip to your word list by
          Message 4 of 7 , Jun 5, 2004
          • 0 Attachment
            Hi Lee,

            This is an improved version of my clip that allows you to search for many
            words, not just one or two. You can modify this clip to your word list by
            creating a list of the words you want to search for as below:

            would
            is
            this
            that
            and
            the
            but

            Then go to the search and replace feature and replace ^p with a semi-colon
            (;) so that you have this:

            would;is;this;that;and;the;but

            Now you place this information at the end of the array line so that it reads:

            ^!SetArray %Word%=would;is;this;that;and;the;but

            And save the clip and you are ready to do your multiword search. I hope
            that this works for you.

            ______[Copy below this line]_______
            H="Find Many Words"
            ;lrt@... e¿ê
            ;06/06/2004, 12:17:04 AM
            ^!SetArray %Word%=would;is;this;that;and;the;but
            ^!Set %Count%=^%word0%; %IDX%=1

            :FindWord
            ^!Jump 1
            :Loop-FindWord
            ^!Find "^%word^%IDX%%" CS
            ^!IfError Skip
            ^!Skip Search for next occurrence of "^%word^%IDX%%"?
            ^!Goto NextWord
            ^!Goto Loop-FindWord

            :NextWord
            ^!If ^%IDX%=^%Count% Exit
            ^!Inc %IDX%
            ^!Goto FindWord
            _____[Copy above this line]______
            | right click over the clipbook |
            | and choose "Add from Clipboard" |
            ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

            The line, ^!Jump 1 causes the search to start for each word from the very
            top/start of the document you are searching.

            Regards,

            Larry
            lrt@... e¿ê
          • Lee Underwood
            Larry, Thanks! This is great! I appreciate your work. Lee
            Message 5 of 7 , Jun 8, 2004
            • 0 Attachment
              Larry,

              Thanks! This is great! I appreciate your work.

              Lee



              At 6/6/04 01:29 AM, Larry Thomas wrote:

              >Hi Lee,
              >
              >This is an improved version of my clip that allows you to search for many
              >words, not just one or two. You can modify this clip to your word list by
              >creating a list of the words you want to search for as below:
              >
              >would
              >is
              >this
              >that
              >and
              >the
              >but
              >
              >Then go to the search and replace feature and replace ^p with a semi-colon
              >(;) so that you have this:
              >
              >would;is;this;that;and;the;but
              >
              >Now you place this information at the end of the array line so that it reads:
              >
              >^!SetArray %Word%=would;is;this;that;and;the;but
              >
              >And save the clip and you are ready to do your multiword search. I hope
              >that this works for you.
              >
              >______[Copy below this line]_______
              >H="Find Many Words"
              >;lrt@... e¿ê
              >;06/06/2004, 12:17:04 AM
              >^!SetArray %Word%=would;is;this;that;and;the;but
              >^!Set %Count%=^%word0%; %IDX%=1
              >
              >:FindWord
              >^!Jump 1
              >:Loop-FindWord
              >^!Find "^%word^%IDX%%" CS
              >^!IfError Skip
              >^!Skip Search for next occurrence of "^%word^%IDX%%"?
              >^!Goto NextWord
              >^!Goto Loop-FindWord
              >
              >:NextWord
              >^!If ^%IDX%=^%Count% Exit
              >^!Inc %IDX%
              >^!Goto FindWord
              > _____[Copy above this line]______
              >| right click over the clipbook |
              >| and choose "Add from Clipboard" |
              > ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
              >
              >The line, ^!Jump 1 causes the search to start for each word from the very
              >top/start of the document you are searching.
              >
              >Regards,
              >
              >Larry
              >lrt@... e¿ê
            • Larry Thomas
              ... Hi Lee, You are very welcome. I do have one more slight improvement to offer with the clip below. This clip works the same as the one I posted before
              Message 6 of 7 , Jun 8, 2004
              • 0 Attachment
                At 12:12 AM 6/9/04 -0400, you wrote:
                >Larry,
                >
                >Thanks! This is great! I appreciate your work.
                >
                >Lee

                Hi Lee,

                You are very welcome. I do have one more slight improvement to offer with
                the clip below. This clip works the same as the one I posted before except
                that it uses the shift key and the ctrl key to control the search operation
                and the message is placed in the status bar at the bottom of the NoteTab
                window.

                When you run the program, it starts searching the same as the other one but
                you get a message in the status bar that tells you what to do so that you
                can see the highlighted words in the open document without having to drag a
                message box out of your way.

                You press the shift key to search for the next occurrence of the current
                word. You press the Ctrl key to switch your search to the next word in the
                list.

                Finally, if you want to quit before all of the list is done, you press and
                hold the Alt key and then press the Ctrl key and the clip will quit.

                Here is the clip:

                ______[Copy below this line]_______
                H="Find Many Words"
                ;lrt@... e¿ê
                ;06/06/2004, 06:26:16 AM
                ^!SetArray %Word%=would;is;this;that;and;the;but
                ^!Set %Count%=^%word0%; %IDX%=1

                :FindWord
                ^!Jump 1
                :Loop-FindWord
                ;^!SetDebug 1
                ;
                ;----------------------[begin long line]---------------------------
                ^!SetHintInfo Press Shift for next occurrence; Press Ctrl for next word;
                Press Ctrl+Alt to stop clip.
                ;-----------------------[end long line]----------------------------
                ;
                ^!Find "^%word^%IDX%%" CS
                ^!IfError NextWord
                ^!Delay 5
                :Loop-Keypress
                ^!IfTrue ^$IsShiftKeyDown$ Loop-FindWord
                ^!IfTrue ^$IsCtrlKeyDown$ NextWord
                ^!Goto Loop-Keypress

                :NextWord
                ^!If ^%IDX%=^%Count% Exit
                ^!Inc %IDX%
                ^!Goto FindWord
                _____[Copy above this line]______
                | right click over the clipbook |
                | and choose "Add from Clipboard" |
                ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

                Be sure to joine the long line that begins with ^!SetHintInfo and ends with
                "Ctrl+Alt to stop clip." This all needs to be on one long line or the clip
                will fail to run properly.

                Regards,

                Larry
                lrt@... e¿ê
              • Lee Underwood
                Larry, Once again, Thanks! This one works very good. I especially appreciate the option to quit. Thanks again! Lee
                Message 7 of 7 , Jun 9, 2004
                • 0 Attachment
                  Larry,

                  Once again, Thanks! This one works very good. I especially appreciate the
                  option to quit. Thanks again!

                  Lee


                  >Hi Lee,
                  >
                  >You are very welcome. I do have one more slight improvement to offer with
                  >the clip below. This clip works the same as the one I posted before except
                  >that it uses the shift key and the ctrl key to control the search operation
                  >and the message is placed in the status bar at the bottom of the NoteTab
                  >window.
                  >
                  >When you run the program, it starts searching the same as the other one but
                  >you get a message in the status bar that tells you what to do so that you
                  >can see the highlighted words in the open document without having to drag a
                  >message box out of your way.
                  >
                  >You press the shift key to search for the next occurrence of the current
                  >word. You press the Ctrl key to switch your search to the next word in the
                  >list.
                  >
                  >Finally, if you want to quit before all of the list is done, you press and
                  >hold the Alt key and then press the Ctrl key and the clip will quit.
                  >
                  >Here is the clip:
                  >
                  >______[Copy below this line]_______
                  >H="Find Many Words"
                  >;lrt@... e¿ê
                  >;06/06/2004, 06:26:16 AM
                  >^!SetArray %Word%=would;is;this;that;and;the;but
                  >^!Set %Count%=^%word0%; %IDX%=1
                  >
                  >:FindWord
                  >^!Jump 1
                  >:Loop-FindWord
                  >;^!SetDebug 1
                  >;
                  >;----------------------[begin long line]---------------------------
                  >^!SetHintInfo Press Shift for next occurrence; Press Ctrl for next word;
                  >Press Ctrl+Alt to stop clip.
                  >;-----------------------[end long line]----------------------------
                  >;
                  >^!Find "^%word^%IDX%%" CS
                  >^!IfError NextWord
                  >^!Delay 5
                  >:Loop-Keypress
                  >^!IfTrue ^$IsShiftKeyDown$ Loop-FindWord
                  >^!IfTrue ^$IsCtrlKeyDown$ NextWord
                  >^!Goto Loop-Keypress
                  >
                  >:NextWord
                  >^!If ^%IDX%=^%Count% Exit
                  >^!Inc %IDX%
                  >^!Goto FindWord
                  > _____[Copy above this line]______
                  >| right click over the clipbook |
                  >| and choose "Add from Clipboard" |
                  > ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
                  >
                  >Be sure to joine the long line that begins with ^!SetHintInfo and ends with
                  >"Ctrl+Alt to stop clip." This all needs to be on one long line or the clip
                  >will fail to run properly.
                  >
                  >Regards,
                  >
                  >Larry
                  >lrt@... e¿ê
                  >
                  >
                  >
                  >
                  >
                  >Yahoo! Groups Links
                  >
                  >
                  >
                  >
                Your message has been successfully submitted and would be delivered to recipients shortly.