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

Re: Help with clip programming

Expand Messages
  • diodeom
    ... An example: ^!Select Paragraphs ^!IfMatch ^[^ r]++ R ^$GetSelection$ Next Else Skip ^!Select -2 ^!SetClipboard ^$GetSelection$ ^!InsertText
    Message 1 of 8 , May 5 1:18 PM
    • 0 Attachment
      > Have you considered ^!Select Paragraphs?
      >

      An example:

      ^!Select Paragraphs
      ^!IfMatch "^[^\r]++\R" "^$GetSelection$" Next Else Skip
      ^!Select -2
      ^!SetClipboard ^$GetSelection$
      ^!InsertText *^$GetClipboard$*
    • John Shotsky
      Yes, same result as ^!Select Lines. When the parens are involved, it throws a Regex error and fails. The selection looks good with both. How do I place parens
      Message 2 of 8 , May 5 1:29 PM
      • 0 Attachment
        Yes, same result as ^!Select Lines. When the parens are involved, it throws a Regex error and fails.

        The selection looks good with both. How do I place parens around the whole selection, not just the
        token?

        Regards,
        John

        From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of diodeom
        Sent: 05 May, 2010 12:54 PM
        To: ntb-clips@yahoogroups.com
        Subject: [Clip] Re: Help with clip programming


        "John Shotsky" <jshotsky@...> wrote:
        >
        > I've found myself stuck on what should have been a fairly simple task.
        >

        Have you considered ^!Select Paragraphs?



        [Non-text portions of this message have been removed]
      • diodeom
        It looks like ^& refers only to the original selection, not the one extended with ^!SelectLines (or -Paragraphs). Have you tried, as in my sample, to
        Message 3 of 8 , May 5 1:45 PM
        • 0 Attachment
          It looks like ^& refers only to the "original" selection, not the one extended with ^!SelectLines (or -Paragraphs). Have you tried, as in my sample, to explicitly ^$GetSelection$ and store it either in Clipboard or as a variable? (It does the job for me.) Would you post your code?

          "John Shotsky" <jshotsky@...> wrote:
          >
          > Yes, same result as ^!Select Lines. When the parens are involved, it throws a Regex error and fails.
          >
          > The selection looks good with both. How do I place parens around the whole selection, not just the
          > token?
          >
          > Regards,
          > John
          >
        • John Shotsky
          I got a version to work. One problem is that I was using RS for options on the replace, which means the parens in the variable were not escaped. Removing the R
          Message 4 of 8 , May 5 2:10 PM
          • 0 Attachment
            I got a version to work. One problem is that I was using RS for options on the replace, which means
            the parens in the variable were not escaped. Removing the R fixed that regex error.

            The other problem was that the trailing CR is included in the GetSelection which causes the closing
            paren to be on the next line. Instead of manipulating the variable, I just fixed it post replace.

            Thanks for the assist!
            Regards,
            John

            From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of diodeom
            Sent: 05 May, 2010 01:18 PM
            To: ntb-clips@yahoogroups.com
            Subject: [Clip] Re: Help with clip programming


            > Have you considered ^!Select Paragraphs?
            >

            An example:

            ^!Select Paragraphs
            ^!IfMatch "^[^\r]++\R" "^$GetSelection$" Next Else Skip
            ^!Select -2
            ^!SetClipboard ^$GetSelection$
            ^!InsertText *^$GetClipboard$*



            [Non-text portions of this message have been removed]
          • diodeom
            ... Yes, sir. (To overcome this, I proposed probably overly complex conditional shrinking of the selection from its end by these very two offending CRLF
            Message 5 of 8 , May 5 2:33 PM
            • 0 Attachment
              "John Shotsky" <jshotsky@...> wrote:
              > ...
              > The other problem was that the trailing CR is included
              > in the GetSelection which causes the closing paren to
              > be on the next line. Instead of manipulating the
              > variable, I just fixed it post replace.
              >

              Yes, sir. (To overcome this, I proposed probably overly complex conditional shrinking of the selection from its end by these very two offending CRLF characters, ^!Select -2.)

              And sorry for the following (oopsie!) redundancy:

              > ^!SetClipboard ^$GetSelection$
              > ^!InsertText (^$GetClipboard$)

              There ain't no need to "store" nothin. It could just read:
              ^!InsertText (^$GetSelection$)
            • John Shotsky
              I always learn something. Thanks, I added the: ^!Select -2 And now it works better. After rereading the help, I understand how it works, but it never dawned on
              Message 6 of 8 , May 5 3:46 PM
              • 0 Attachment
                I always learn something. Thanks, I added the:
                ^!Select -2
                And now it works better.
                After rereading the help, I understand how it works, but it never dawned on me during my
                experimentation.

                I have a 'My Notes' clip in my main library. I add notes that clarify how to do things there. It is
                just a NoteTab text file stored in the Documents folder, but it is called up by a clip. I usually
                have it as one of my open documents so I can add to it when necessary. This deserves to go there.

                Regards,
                John

                From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of diodeom
                Sent: 05 May, 2010 02:33 PM
                To: ntb-clips@yahoogroups.com
                Subject: [Clip] Re: Help with clip programming


                "John Shotsky" <jshotsky@...> wrote:
                > ...
                > The other problem was that the trailing CR is included
                > in the GetSelection which causes the closing paren to
                > be on the next line. Instead of manipulating the
                > variable, I just fixed it post replace.
                >

                Yes, sir. (To overcome this, I proposed probably overly complex conditional shrinking of the
                selection from its end by these very two offending CRLF characters, ^!Select -2.)

                And sorry for the following (oopsie!) redundancy:

                > ^!SetClipboard ^$GetSelection$
                > ^!InsertText (^$GetClipboard$)

                There ain't no need to "store" nothin. It could just read:
                ^!InsertText (^$GetSelection$)



                [Non-text portions of this message have been removed]
              Your message has been successfully submitted and would be delivered to recipients shortly.