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

RegExp search of Clipboard contents

Expand Messages
  • Warner
    Is there a way within a clip to do a regexp search on the contents of the Clipboard without temporarily opening a file and inserting the contents? If it were
    Message 1 of 15 , Mar 5, 2003
    • 0 Attachment
      Is there a way within a clip to do a regexp search on the
      contents of the Clipboard without temporarily opening a file and
      inserting the contents? If it were a simple Find it could be
      done on by assigning it to a string, but apparently not Regexp
      search. I know the first way works, but it seems a little
      cumbersome.
      Warner
    • Sheri
      ... You can do logical testing on a string using regexp with the ^! IfMatch command, if that is of any help. Regards, Sheri
      Message 2 of 15 , Mar 5, 2003
      • 0 Attachment
        --- In ntb-clips@yahoogroups.com, "Warner" <whug@a...> wrote:
        > Is there a way within a clip to do a regexp search on the
        > contents of the Clipboard without temporarily opening a file and
        > inserting the contents? If it were a simple Find it could be
        > done on by assigning it to a string, but apparently not Regexp
        > search. I know the first way works, but it seems a little
        > cumbersome.
        > Warner

        You can do logical testing on a string using regexp with the ^!
        IfMatch command, if that is of any help.

        Regards,
        Sheri
      • Jody
        Hi Warner, You can do something like: H=Clipboard RegExp ; eMailed on 03-05-2003, Jody@NoteTab.net ; notetab.net,
        Message 3 of 15 , Mar 5, 2003
        • 0 Attachment
          Hi Warner,

          You can do something like:

          <--- Copy below this line --->
          H=Clipboard RegExp
          ; eMailed on 03-05-2003, Jody@...
          ; notetab.net, notetab.net/html/cd-info.htm
          ; seems sort of ackward, but it appears that it may work. If you
          ; use the commented ;^!Set you will probably want to use
          ; ^$GetClipboard$ for the results. You can use Str functions,
          ; but not with RegExp. See the second Clip.

          ^!Set %Clipboard%=^$GetClipboard$; %Find%=^?{Find what=^&|_^$GetBlock$}
          ; ^!Set %Clipboard%=^$GetClipboard$; %Find%=^?{Replace what=^&|_^$GetBlock$}
          ^!Replace "^%Clipboard%" >> "^%Find%" RA
          ^!IfError Next else Skip
          ^!Info NotFound

          H=Search Clipboard
          ; eMailed on 03-05-2003, Jody@...
          ; notetab.net, notetab.net/html/cd-info.htm
          ; ^!Set and ^!If long lines...
          ; Try ^$StrReplace and ^$GetClipboard$ together too.

          ^!Set %IsOnCB%=^?[Find=^&]; %Case%=^?[Case Sensitive=Yes|_No]; %ww%=^?[Whole word=_Yes|No]
          ^!If ^$StrCount("^%IsOnCB%";"^$GetClipboard$";^%Case%;^%ww%)$ >= 1 Next else NotFound
          ^!Info Found
          ^!Goto Exit
          :NotFound
          ^!Info NotFound

          <--- Copy above this line --->
          <--- Right click over a Library --->
          <--- Choose: Add from Clipboard --->

          >Is there a way within a clip to do a regexp search on the
          >contents of the Clipboard without temporarily opening a file and
          >inserting the contents? If it were a simple Find it could be
          >done on by assigning it to a string, but apparently not Regexp
          >search. I know the first way works, but it seems a little
          >cumbersome.


          Happy Clip'n!
          Jody

          http://www.notetab.net

          Subscribe, UnSubscribe, Options
          mailto:Ntb-Clips-Subscribe@yahoogroups.com
          mailto:Ntb-Clips-UnSubscribe@yahoogroups.com
          http://groups.yahoo.com/group/ntb-clips
        • hugo_paulissen
          ... Warner, Jody, Sheri, I came up with this solution... ^!SetScreenUpdate OFF ^!Set %activeDoc%=^$GetDocIndex$ ^!TextToFile FileName.txt ^$GetClipboard$
          Message 4 of 15 , Mar 5, 2003
          • 0 Attachment
            --- In ntb-clips@yahoogroups.com, "Warner" <whug@a...> wrote:
            > Is there a way within a clip to do a regexp search on the
            > contents of the Clipboard without temporarily opening a file and
            > inserting the contents? If it were a simple Find it could be

            Warner, Jody, Sheri,

            I came up with this solution...

            ^!SetScreenUpdate OFF
            ^!Set %activeDoc%=^$GetDocIndex$
            ^!TextToFile FileName.txt ^$GetClipboard$
            ^!Open "FileName.txt"
            ; your regexp is on the next line...
            ^!Find "...\s." RS
            ^!IfError SHOW
            ^!SetClipboard ^$GetSelection$
            :SHOW
            ^!DestroyDoc
            ^!SetDocIndex ^%activeDoc%
            ^!SetScreenUpdate ON
            ^!INFO ^$GetClipboard$
          • Jody
            Hi Warner & Sheri, Oops, forgot about IfMatch - I have never used it since I don t RegExp much. I normally just open a temp file and ^!Close Discard when I m
            Message 5 of 15 , Mar 5, 2003
            • 0 Attachment
              Hi Warner & Sheri,

              Oops, forgot about IfMatch - I have never used it since I don't RegExp much.
              I normally just open a temp file and ^!Close Discard when I'm done with it.
              I use ^!SetHintInfo Working... & ^!SetScreenUpdate Off so I never notice it
              open. ^!IfMatch is used below...

              <--- Copy below this line --->
              H=Clipboard RegExp2
              ; eMailed on 03-05-2003, Jody@...
              ; notetab.net, notetab.net/html/cd-info.htm

              ^!Set %Clipboard%=^$GetClipboard$; %Find%=^?{RegExp}
              ^!IfMatch "^%Find%" >> "^%Clipboard%" Next else End
              ^!Set %OutData%=^$StrReplace("Substr";"Replacestr";"Str";Casesensitive;Wholeword)$
              ^!Info ^%OutData%

              H=Clipboard RegExp
              ; eMailed on 03-05-2003, Jody@...
              ; notetab.net, notetab.net/html/cd-info.htm

              ^!Set %Clipboard%=^$GetClipboard$; %Find%=^?{Find what=^&|_^$GetBlock$}
              ^!Replace "^%Clipboard%" >> "^%Find%" RA
              ^!IfError Next else Skip
              ^!Info NotFound

              H=Search Clipboard
              ; eMailed on 03-05-2003, Jody@...
              ; notetab.net, notetab.net/html/cd-info.htm

              ^!Set %IsOnCB%=^?[Find=^&]; %Case%=^?[Case Sensitive=Yes|_No]; %ww%=^?[Whole word=_Yes|No]
              ^!If ^$StrCount("^%IsOnCB%";"^$GetClipboard$";^%Case%;^%ww%)$ >= 1 Next else NotFound
              ^!Info Found
              ^!Goto Exit
              :NotFound
              ^!Info NotFound

              <--- Copy above this line --->
              <--- Right click over a Library --->
              <--- Choose: Add from Clipboard --->


              >You can do logical testing on a string using regexp with the ^!
              >IfMatch command, if that is of any help.


              Happy Clip'n!
              Jody

              http://www.notetab.net

              Subscribe, UnSubscribe, Options
              mailto:Ntb-Clips-Subscribe@yahoogroups.com
              mailto:Ntb-Clips-UnSubscribe@yahoogroups.com
              http://groups.yahoo.com/group/ntb-clips
            • Sheri
              ... Hi Hugo (Warner, Jody), Here s a possible improvement, since the info is already on the clipboard and no temporary files are desired. I would suggest
              Message 6 of 15 , Mar 5, 2003
              • 0 Attachment
                At 11:40 PM 3/5/03 +0000, Hugo wrote:

                >I came up with this solution...
                >
                >^!SetScreenUpdate OFF
                >^!Set %activeDoc%=^$GetDocIndex$
                >^!TextToFile FileName.txt ^$GetClipboard$
                >^!Open "FileName.txt"
                >; your regexp is on the next line...
                >^!Find "...\s." RS
                >^!IfError SHOW
                >^!SetClipboard ^$GetSelection$
                >:SHOW
                >^!DestroyDoc
                >^!SetDocIndex ^%activeDoc%
                >^!SetScreenUpdate ON
                >^!INFO ^$GetClipboard$

                Hi Hugo (Warner, Jody),

                Here's a possible improvement, since the info is already on the clipboard and no temporary files are desired. I would suggest substituting the following for your ^!TextToFile, ^!Open and ^!DestroyDoc ...

                ^!Menu Edit/Paste New
                etc., etc.
                ^!Close Discard

                Regards,
                Sheri
              • Warner
                Jody, Sheri, Hugo, Thanks for the usual good ideas. Hugo s does what I wanted, which was to pick up any (the first) instance of a phone number on the
                Message 7 of 15 , Mar 5, 2003
                • 0 Attachment
                  Jody, Sheri, Hugo,
                  Thanks for the usual good ideas. Hugo's does what I wanted,
                  which was to pick up any (the first) instance of a phone number
                  on the Clipboard contents (from another application usually). I
                  had done pretty much the same thing except using ^!Toolbar Paste
                  New and ^!Close Discard. I don't think Jody's will do that, but
                  does come close to what I was looking for...doing it without
                  opening a temp doc.

                  Thanks for reminding me of a couple of commands I'd missed or
                  forgotten.

                  > I came up with this solution...
                  >
                  > ^!SetScreenUpdate OFF
                  > ^!Set %activeDoc%=^$GetDocIndex$
                  > ^!TextToFile FileName.txt ^$GetClipboard$
                  > ^!Open "FileName.txt"
                  > ; your regexp is on the next line...
                  > ^!Find "...\s." RS
                  > ^!IfError SHOW
                  > ^!SetClipboard ^$GetSelection$
                  > :SHOW
                  > ^!DestroyDoc
                  > ^!SetDocIndex ^%activeDoc%
                  > ^!SetScreenUpdate ON
                  > ^!INFO ^$GetClipboard$
                  >
                  >
                  > ------------------------ Yahoo! Groups
                  Sponsor ---------------------~-->
                  > Get 128 Bit SSL Encryption!
                  > http://us.click.yahoo.com/LIgTpC/vN2EAA/xGHJAA/dkFolB/TM
                  > --------------------------------------------------------------
                  -------~->
                  >
                  >
                  >
                  > Your use of Yahoo! Groups is subject to
                  http://docs.yahoo.com/info/terms/
                  >
                  >
                • Jody
                  Hi Warner, ... Disregard mine anyway. I fell asleep while rushing out the door. :) Here is an example of using ^!SetHintInfo & ^!SetScreenUpdate (getting a
                  Message 8 of 15 , Mar 5, 2003
                  • 0 Attachment
                    Hi Warner,

                    >I don't think Jody's will do that, but does come close to what I
                    >was looking for...doing it without opening a temp doc.

                    Disregard mine anyway. I "fell asleep" while rushing out the
                    door. :) Here is an example of using ^!SetHintInfo &
                    ^!SetScreenUpdate (getting a US phone number) so that you don't
                    see it being done in NoteTab. And, of course there are many things
                    to do with it when you get it.

                    <--- Copy below this line --->
                    H=Find Phone Number
                    ; eMailed on 03-06-2003, Jody@...
                    ; notetab.net, notetab.net/html/cd-info.htm

                    ^!SetHintInfo Working...
                    ^!SetScreenUpdate Off

                    ^!Set %CDoc%=^$GetDocIndex$
                    ^!ToolBar Paste New
                    ^!Jump 1
                    ^!Find "\d\d\d-\d\d\d\d\s" R
                    ^!IfError Skip else Next
                    ^!Set %Number%=^$GetBlock$
                    ^!Close Discard
                    ^!SetDocIndex ^%CDoc%
                    ^!Info ^%Number%
                    ; ^%Number%
                    ; ^!SetClipboard ^%Number%
                    ; ^!AppendToFile "FullFileName.ext"

                    <--- Copy above this line --->
                    <--- Right click over a Library --->
                    <--- Choose: Add from Clipboard --->

                    Happy Clip'n!
                    Jody

                    http://www.notetab.net

                    Subscribe, UnSubscribe, Options
                    mailto:Ntb-Clips-Subscribe@yahoogroups.com
                    mailto:Ntb-Clips-UnSubscribe@yahoogroups.com
                    http://groups.yahoo.com/group/ntb-clips
                  • Warner
                    Jody, Hi. You certainly weren t asleep on that one (that was _your_ characterization, not mine). Works beautifully with your usual succinctness. Thanks and
                    Message 9 of 15 , Mar 6, 2003
                    • 0 Attachment
                      Jody,
                      Hi. You certainly weren't asleep on that one (that was _your_
                      characterization, not mine). Works beautifully with your usual
                      succinctness.
                      Thanks and happy clipp'n to you too.
                      Warner

                      ----- Original Message -----
                      From: "Jody" <av1611@...>
                      To: <ntb-clips@yahoogroups.com>
                      Sent: Wednesday, March 05, 2003 10:53 PM
                      Subject: Re: [Clip] Re: RegExp search of Clipboard contents


                      > Hi Warner,
                      >
                      > >I don't think Jody's will do that, but does come close to
                      what I
                      > >was looking for...doing it without opening a temp doc.
                      >
                      > Disregard mine anyway. I "fell asleep" while rushing out the
                      > door. :) Here is an example of using ^!SetHintInfo &
                      > ^!SetScreenUpdate (getting a US phone number) so that you
                      don't
                      > see it being done in NoteTab. And, of course there are many
                      things
                      > to do with it when you get it.
                      >
                      > <--- Copy below this line --->
                      > H=Find Phone Number
                      > ; eMailed on 03-06-2003, Jody@...
                      > ; notetab.net, notetab.net/html/cd-info.htm
                      >
                      > ^!SetHintInfo Working...
                      > ^!SetScreenUpdate Off
                      >
                      > ^!Set %CDoc%=^$GetDocIndex$
                      > ^!ToolBar Paste New
                      > ^!Jump 1
                      > ^!Find "\d\d\d-\d\d\d\d\s" R
                      > ^!IfError Skip else Next
                      > ^!Set %Number%=^$GetBlock$
                      > ^!Close Discard
                      > ^!SetDocIndex ^%CDoc%
                      > ^!Info ^%Number%
                      > ; ^%Number%
                      > ; ^!SetClipboard ^%Number%
                      > ; ^!AppendToFile "FullFileName.ext"
                      >
                      > <--- Copy above this line --->
                      > <--- Right click over a Library --->
                      > <--- Choose: Add from Clipboard --->
                      >
                      > Happy Clip'n!
                      > Jody
                      >
                      > http://www.notetab.net
                      >
                      > Subscribe, UnSubscribe, Options
                      > mailto:Ntb-Clips-Subscribe@yahoogroups.com
                      > mailto:Ntb-Clips-UnSubscribe@yahoogroups.com
                      > http://groups.yahoo.com/group/ntb-clips
                      >
                      >
                      > ------------------------ Yahoo! Groups
                      Sponsor ---------------------~-->
                      > Get 128 Bit SSL Encryption!
                      > http://us.click.yahoo.com/LIgTpC/vN2EAA/xGHJAA/dkFolB/TM
                      > --------------------------------------------------------------
                      -------~->
                      >
                      >
                      >
                      > Your use of Yahoo! Groups is subject to
                      http://docs.yahoo.com/info/terms/
                      >
                      >
                    • hugo_paulissen
                      Hi Sheri, The clip was meant to be adapted by Warner ;-) it was just an idea. I don t really see the point of your remark to use Paste/Close a new document
                      Message 10 of 15 , Mar 6, 2003
                      • 0 Attachment
                        Hi Sheri,

                        The clip was meant to be adapted by Warner ;-) it was just an idea.

                        I don't really see the point of your remark to use Paste/Close a new
                        document instead of actually creating a document and deleting it. In
                        my view the Paste New Doc line creates a temporary file as well -
                        except it isn't written to disk - maybe that's the difference...

                        >
                        > Here's a possible improvement, since the info is already on the
                        clipboard and no temporary files are desired. I would suggest
                        substituting the following for your ^!TextToFile, ^!Open and ^!
                        DestroyDoc ...

                        Hugo
                      • Alan C.
                        Hi Hugo, some of other clip subscribers too perhaps ... It could be called a temporary file. It could also be called a buffer. You re correct in that it s
                        Message 11 of 15 , Mar 7, 2003
                        • 0 Attachment
                          Hi Hugo, some of other clip subscribers too perhaps

                          >In
                          >my view the Paste New Doc line creates a temporary file as well -
                          >except it isn't written to disk - maybe that's the difference...

                          It could be called a temporary file. It could also be called a buffer. You're correct in that it's not written to disk. And, yes, as far as either a or any difference, that is a/the difference; it's the only difference that I could see.

                          Lots of stuff can be done/accomplished in just physical ram memory. I generally prefer that; it's faster and saves on hard drive useage. So, I reserve the writing to disk to a category of "to not do it unless my process requires it".

                          The above (about preference to do it in physical ram memory) is applicable I would say on the average; average being with, say, not necessarily a totally modern computer, but a modern enough computer so as to have *sufficient amount of* the physical ram memory.

                          That said, (about the computer's physical ram memory)--> But there's also another type of memory: virtual memory. The latter is used whenever the demand for memory over exceeds the computer's amount of physical memory. Say, for example, your computer is equipped with 256 megabytes of ram and the current process needs 330 megabytes of memory--well then, the difference between those two numbers would be the size of the virtual memory utilization.

                          To take it to the extreme, an old computer with very little ram is apt/prone to rely heavily on virtual memory. Virtual memory is nothing but a swap file on the hard drive (writing and swapping to disk in sequential fashion as your process occurs). In such extreme, a "buffer" in memory could turn into using the swap file (writing to disk). (Just to point out some of the border and/or (potential lack of) any border between memory and writing to disk).

                          --
                          Later. Alan.
                        • hsavage
                          ... Hugo, Sheri, In the short test I did to check the difference between ^!ToolBar Paste New and ^!Menu File/New I used the simple clip below. I see no
                          Message 12 of 15 , Mar 7, 2003
                          • 0 Attachment
                            hugo_paulissen wrote:

                            >Hi Sheri,
                            >
                            >I don't really see the point of your remark to use Paste/Close a new
                            >document instead of actually creating a document and deleting it. In
                            >my view the Paste New Doc line creates a temporary file as well -
                            >except it isn't written to disk - maybe that's the difference...
                            >
                            >Hugo
                            >
                            >
                            Hugo, Sheri,

                            In the short test I did to check the difference between ^!ToolBar Paste
                            New and ^!Menu File/New I used the simple clip below.

                            I see no difference, neither command creates a new file on disk until
                            you actually save each file, either method appears to be created in Ram
                            only.

                            I verified this by running the clip then checking the folder with
                            PowerDesk that each one would be saved into if either one were saved.
                            There was no tell-tale sign of a Noname01 or Noname02 on the hard disk.

                            hrs

                            h=newdoctest
                            ^!Set %x%=Long string of text to be inserted into each new document.
                            ^!ToolBar Paste New
                            ^%x%
                            ^!Menu File/New
                            ^%x%
                          • Alan C.
                            Hi hrs, ... I think Hugo referenced his clip which I ve enclosed below. It uses texttofile which writes to disk then he opened the file. That was what my
                            Message 13 of 15 , Mar 7, 2003
                            • 0 Attachment
                              Hi hrs,

                              >In the short test I did to check the difference between ^!ToolBar Paste
                              >New and ^!Menu File/New I used the simple clip below.

                              I think Hugo referenced his clip which I've enclosed below. It uses texttofile which writes to disk then he opened the file.

                              That was what my earlier response was geared toward anyways - his texttofile versus Sheri's menu paste new

                              >^!SetScreenUpdate OFF
                              >^!Set %activeDoc%=^$GetDocIndex$
                              >^!TextToFile FileName.txt ^$GetClipboard$
                              >^!Open "FileName.txt"
                              >; your regexp is on the next line...
                              >^!Find "...\s." RS
                              >^!IfError SHOW
                              >^!SetClipboard ^$GetSelection$
                              >:SHOW
                              >^!DestroyDoc
                              >^!SetDocIndex ^%activeDoc%
                              >^!SetScreenUpdate ON
                              >^!INFO ^$GetClipboard$
                            • Sheri
                              ... Hi Hugo, I meant only to suggest a possible improvement, nothing more. YMMV :). I try to use memory instead of disk in situations that permit it, and
                              Message 14 of 15 , Mar 8, 2003
                              • 0 Attachment
                                At 10:36 PM 3/6/03 +0000, you wrote:
                                >Hi Sheri,
                                >
                                >The clip was meant to be adapted by Warner ;-) it was just an idea.
                                >
                                >I don't really see the point of your remark to use Paste/Close a new
                                >document instead of actually creating a document and deleting it. In
                                >my view the Paste New Doc line creates a temporary file as well -
                                >except it isn't written to disk - maybe that's the difference...
                                >
                                >>
                                >> Here's a possible improvement, since the info is already on the
                                >clipboard and no temporary files are desired. I would suggest
                                >substituting the following for your ^!TextToFile, ^!Open and ^!
                                >DestroyDoc ...
                                >
                                >Hugo


                                Hi Hugo,

                                I meant only to suggest a possible improvement, nothing more. YMMV :). I try to use memory instead of disk in situations that permit it, and operating on clipboard contents is a good example of that.

                                Regards,
                                Sheri
                              • hugo_paulissen
                                Alan, HRS and Sheri, ... uses texttofile which writes to disk then he opened the file. Yes, I was referring to that. Thank you for your input, and Sheri I see
                                Message 15 of 15 , Mar 8, 2003
                                • 0 Attachment
                                  Alan, HRS and Sheri,

                                  > I think Hugo referenced his clip which I've enclosed below. It
                                  uses texttofile which writes to disk then he opened the file.

                                  Yes, I was referring to that.

                                  Thank you for your input, and Sheri I see what you mean about not
                                  using a file to store the clipboard contents - although I doubt
                                  whether there is much to win/loose with either approach (hence my
                                  question).

                                  OT - Sheri, looking up <Your Mileage May Vary> I found "The Jargon
                                  Dictionary". A nice read - http://info.astrian.net/jargon

                                  Hugo
                                Your message has been successfully submitted and would be delivered to recipients shortly.