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

Re: [Clip] Re: How to copy and paste a line without activating ^* ?

Expand Messages
  • Axel Berger
    ... Have you tried ^$GetLine$? (I must admit I have not.) If it is the whole line you want anyway this will also simplify your find string. Axel
    Message 1 of 21 , Nov 7, 2010
    • 0 Attachment
      joy8388608 wrote:
      > I have a clip that searches for a string and copies each line
      > containing that string to a new doc.

      Have you tried ^$GetLine$? (I must admit I have not.) If it is the whole
      line you want anyway this will also simplify your find string.

      Axel
    • diodeom
      ... To clarify, there are circumstances where ^$GetSelection$ does not jump to evaluate ^*, at least not for me, e.g. when placed as an argument inside the
      Message 2 of 21 , Nov 7, 2010
      • 0 Attachment
        joy8388608 <mycroftj@...> wrote:
        >
        > (...) I was wondering if there was a way to do something like getselection without causing the substitution. Apparently not.
        >
        >

        To clarify, there are circumstances where ^$GetSelection$ does not jump to evaluate ^*, at least not for me, e.g. when placed as an argument inside the ^$StrReplace()$ function (as shown in my previous message). And here's an outline of another working solution:

        ^!IfSame "^" "^$StrCopyLeft(^$GetSelection$;1)$" Next Else NoCaret
        ^!SetClipboard ^$StrDeleteLeft(^$GetSelection$;1)$
        ;...
        ;In the destination doc
        ^!Menu File/New
        ^!InsertCode ^^$GetClipboard$
        ^!Goto End

        :NoCaret
        ^!SetClipboard ^$GetSelection$
        ;...
        ;In the destination doc
        ^!Menu File/New
        ^!Paste
      • diodeom
        ... I d think that unless NT engages in some potentially troublesome guesswork regarding carets and their context, or until there is some special syntax
        Message 3 of 21 , Nov 7, 2010
        • 0 Attachment
          joy8388608 wrote:
          > (...)
          > I was surprised to find ^$GetSelection$ triggered the substitution. I did know about the ^* (or I would have gone mad trying to figure out what was going on!) but the documentation was not clear on this. I thought it would only happen when a clip was executing a program and passing the doc name (^*) as a parameter. i.e. ^!WordPad ^*
          >
          > This is not a huge problem but I thought there would be a simple answer. Perhaps not but if anyone thinks of anything...
          >
          >

          I'd think that unless NT engages in some potentially troublesome guesswork regarding carets and their context, or until there is some special syntax provided (besides ^!InsertCode and, in template files, ClipCode keyword) to indicate certain characters or constructs as meaningless to the interpreter, it's probably pretty practical to just love thy neighboring caret, recognize its exceptional significance, and apply preventive measures or workarounds as needed.
        • ebbtidalflats
          Well, then you have your answer in some of the other posts, to replace all carets in the SOURCE document with a token, before you find and copy a specific
          Message 4 of 21 , Nov 8, 2010
          • 0 Attachment
            Well, then you have your answer in some of the other posts, to replace all carets in the SOURCE document with a token, before you find and copy a specific string, then replace the tokens with the caret in both the SOURCE AND TARGET when all strings are copied.

            Just be sure to use a token not found in either the source or target.

            Cheers,


            Eb


            --- In ntb-clips@yahoogroups.com, "joy8388608" <mycroftj@...> wrote:
            >
            > Sorry, but you misunderstand.
            > I have a clip that searches for a string and copies each line containing that string to a new doc.
            >
            > Pretty much it's a find, select line, getselection, switch to new doc, paste line (loop).



            >
            > When the line containing the search string starts with (or contains, I suppose) the ^* or ^** string, the substitution is automatically done by the getselection function. I don't know the contents of the lines being copied - only that they contain my search string.
            >
            > I'm sure I could do something like replace all ^* with a unique string before processing in the orig doc and then change back in the orig and new doc after copies, or get the 'value' of ^* and change that string (back) to ^* in the new doc (or something like that) but that's not the point. I was wondering if there was a way to do something like getselection without causing the substitution. Apparently not.
            >
            > I was surprised to find ^$GetSelection$ triggered the substitution. I did know about the ^* (or I would have gone mad trying to figure out what was going on!) but the documentation was not clear on this. I thought it would only happen when a clip was executing a program and passing the doc name (^*) as a parameter. i.e. ^!WordPad ^*
            >
            > This is not a huge problem but I thought there would be a simple answer. Perhaps not but if anyone thinks of anything...
            >
            > Thanks again for the responses. It's wonderful to have so many knowledgeable and helpful people willing to answer questions and help others.
            >
            > Joy
            >
            >
            >
            > --- In ntb-clips@yahoogroups.com, "Eb" <ebbtidalflats@> wrote:
            > >
            > > The solution I use is to spread the past over two lines:
            > >
            > > ^!InsertText ^%caret%
            > > ^!InsertText ** etc
            > >
            > > This is the same approach as pasting a separator, and then replacing it, but without the replacing step (the separator is the neline).
            > >
            > > Cheers,
            > >
            > >
            > > Eb
            > >
            > >
            > > --- In ntb-clips@yahoogroups.com, "joy8388608" <mycroftj@> wrote:
            > > >
            > > > I'm having an issue with my clip that extracts lines from one doc to another when the line contains ^* such as
            > > >
            > > > ^******************this is line 1
            > > >
            > > > I'm using
            > > > ^!SetClipboard ^$GetSelection$ \ ^!Paste
            > > > and a few other things, but it seems to be the GetSelection that is interpreting it.
            > > >
            > > > How else would I copy a line without this happening?
            > > >
            > > > Also, where does ^* get set? It is certainly displaying one of my folders, but that folder is not open or being used now although I did use it earlier today.
            > > >
            > > > Thanks!
            > > > Joy
            > > >
            > >
            >
          • joy8388608
            ... ^$GetLine$ translates ^* also but is worse than SelectLine GetSelection since GetLine does NOT return the CRLF and the other way does. I just tried to
            Message 5 of 21 , Nov 8, 2010
            • 0 Attachment
              --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
              >
              > joy8388608 wrote:
              > > I have a clip that searches for a string and copies each line
              > > containing that string to a new doc.
              >
              > Have you tried ^$GetLine$? (I must admit I have not.) If it is the whole
              > line you want anyway this will also simplify your find string.
              >
              > Axel
              >

              ^$GetLine$ translates ^* also but is worse than SelectLine\GetSelection since GetLine does NOT return the CRLF and the other way does.

              I just tried to replace all ^* with ^xxxx* but the REPLACE command also translates the ^*. Even ^%CARET%* gets translated!!!

              Oh well. This has been interesting and something to remember, but it's not important enough (at least to me) to spend more time on.

              But thanks for trying!

              Joy
            • John Shotsky
              You need to use an escape character to process these characters. Replace ^ * with xxxx works just fine. Regards, John
              Message 6 of 21 , Nov 8, 2010
              • 0 Attachment
                You need to use an escape character to process these characters.

                Replace \^\* with xxxx works just fine.

                Regards,
                John
                <http://recipetoolz.com/> http://recipetoolz.com

                From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of joy8388608
                Sent: Monday, November 08, 2010 10:14
                To: ntb-clips@yahoogroups.com
                Subject: [Clip] Re: How to copy and paste a line without activating ^* ?




                --- In ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com> , Axel Berger <Axel-Berger@...> wrote:
                >
                > joy8388608 wrote:
                > > I have a clip that searches for a string and copies each line
                > > containing that string to a new doc.
                >
                > Have you tried ^$GetLine$? (I must admit I have not.) If it is the whole
                > line you want anyway this will also simplify your find string.
                >
                > Axel
                >

                ^$GetLine$ translates ^* also but is worse than SelectLine\GetSelection since GetLine does NOT return the CRLF and the
                other way does.

                I just tried to replace all ^* with ^xxxx* but the REPLACE command also translates the ^*. Even ^%CARET%* gets
                translated!!!

                Oh well. This has been interesting and something to remember, but it's not important enough (at least to me) to spend
                more time on.

                But thanks for trying!

                Joy



                [Non-text portions of this message have been removed]
              • abairheart
                You ll have to make more of an effort to read the replies to your posts, if you actually WANT help. The problem is the caret, not the asterisk. So search and
                Message 7 of 21 , Nov 9, 2010
                • 0 Attachment
                  You'll have to make more of an effort to read the replies to your posts, if you actually WANT help.

                  The problem is the caret, not the asterisk.
                  So search and replace ONLY the caret, then restore it when done.




                  --- In ntb-clips@yahoogroups.com, "joy8388608" <mycroftj@...> wrote:
                  >
                  >
                  >
                  > --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@> wrote:
                  > >
                  > > joy8388608 wrote:
                  > > > I have a clip that searches for a string and copies each line
                  > > > containing that string to a new doc.
                  > >
                  > > Have you tried ^$GetLine$? (I must admit I have not.) If it is the whole
                  > > line you want anyway this will also simplify your find string.
                  > >
                  > > Axel
                  > >
                  >
                  > ^$GetLine$ translates ^* also but is worse than SelectLine\GetSelection since GetLine does NOT return the CRLF and the other way does.
                  >
                  > I just tried to replace all ^* with ^xxxx* but the REPLACE command also translates the ^*. Even ^%CARET%* gets translated!!!
                  >
                  > Oh well. This has been interesting and something to remember, but it's not important enough (at least to me) to spend more time on.
                  >
                  > But thanks for trying!
                  >
                  > Joy
                  >
                • hsavage
                  ... posts, if you actually WANT help. ... Joy, airhead s, As indicated in this email the only character causing the problem is the caret, the lines below,
                  Message 8 of 21 , Nov 9, 2010
                  • 0 Attachment
                    airhead's wrote:
                    > You'll have to make more of an effort to read the replies to your
                    posts, if you actually WANT help.
                    >
                    > The problem is the caret, not the asterisk.
                    > So search and replace ONLY the caret, then restore it when done.


                    Joy, airhead's,

                    As indicated in this email the only character causing the problem is
                    the caret, the lines below, properly placed in your clip, should
                    solve your problem.

                    I have clips, in use for some time, for this same problem and this
                    should take care or it.


                    H="change carets"
                    ;_sample substitution characters - ¥¤§«¢¿?
                    ;_
                    ;_This assumes you will not be
                    ;_saving the sourcefile after all
                    ;_search operations are completed.
                    ;_
                    ^!Replace "^%caret%" >> "¿?" TWHSA
                    ;_
                    ;_place this line in your clip where
                    ;_it only operates on SOURCE file.
                    ;_add above line at beginning of
                    ;_clip to replace all carets in
                    ;_SOURCE before doing search.
                    ;_SOURCE file must be focused.
                    ;_¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
                    ;_to restore any/all carets in DEST
                    ;_
                    ^!Replace "¿?" >> "^%caret%" TWHSA
                    ;_
                    ;_place this line where it operates only
                    ;_on DEST after each PASTE operation.

                    Use whatever special characters you choose to swap with caret. I
                    find them using the Windows C:\WINDOWS\system32\charmap.exe utility.

                    ·············································
                    ºvº SL_day# 313 - created 2010.11.09_18.48.33

                    Rules guys wish girls knew...
                    • Yes and No are perfectly acceptable answers.

                    € hrs € hsavage € pobox € com
                  • flo.gehrke
                    ... ^$GetSelection$ is prevented from interpreting that ^** token if the search is being executed with a RegEx. Given a line like... ^***line Combined with
                    Message 9 of 21 , Nov 10, 2010
                    • 0 Attachment
                      --- In ntb-clips@yahoogroups.com, "joy8388608" <mycroftj@...> wrote:
                      >
                      > Sorry, but you misunderstand.
                      > I have a clip that searches for a string and copies each line
                      > containing that string to a new doc.

                      ^$GetSelection$ is prevented from interpreting that ^** token if the search is being executed with a RegEx.

                      Given a line like...

                      ^***line

                      Combined with diodeom's trick (deleting the leading caret and inserting it later) the whole job could be...

                      ^!Jump 1
                      ^!Find "\^\Q***\Eline" RS
                      ^!SetClipboard ^$StrDeleteLeft(^$GetSelection$;1)$
                      ^!Toolbar New Document
                      ^!InsertCode ^^$GetClipboard$

                      Regards,
                      Flo
                    • flo.gehrke
                      ... Sorry, that s nonsense ;-) The RegEx is just a solution for executing ^!Find without interpreting ^** as a NT-token. It s diodeom s trick which prevents
                      Message 10 of 21 , Nov 10, 2010
                      • 0 Attachment
                        --- In ntb-clips@yahoogroups.com, "flo.gehrke" <flo.gehrke@...> wrote:
                        >
                        > ^$GetSelection$ is prevented from interpreting that ^** token if the
                        > search is being executed with a RegEx.

                        Sorry, that's nonsense ;-)

                        The RegEx is just a solution for executing ^!Find without interpreting ^** as a NT-token. It's diodeom's trick which prevents ^$GetSelection$ from interpreting that token.

                        Nevertheless, that it's the whole clip that might contribute to Joy's problem...

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