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

NAND per sand (NOT Ampersand)

Expand Messages
  • ebbtidalflats
    Hi Y all, If anyone has a little time between turkey sandwiches, I have a user-defined function (custom function) which under SOME conditions does not execute
    Message 1 of 9 , Nov 29, 2008
    • 0 Attachment
      Hi Y'all,

      If anyone has a little time between turkey sandwiches, I have a
      user-defined function (custom function) which under SOME conditions
      does not execute its code as expected. The clip is below, along with
      two other clips to call the udf, and feed it.
      I think it's a bug, but before I report yet another mystery bugs to
      Fookes software, that they cannot duplicate, I thougt I'd ask here if
      anyone can actually reproduce this bug.

      The problem:

      When I use ^& as argument passer, AND there are more than one line of
      text in the "Sample Text" clip, the code [^!Set
      %arg%=^$StrReplace("^%nl%^%nl%^%nl%";"^%nl%^%nl%";"^%arg%";0;0)$] in
      the clip "StripDoubleBlankLines" pastes the content of the lines
      AFTER the first group of newlines (1 or more) to the current document.

      My test clips, that reproduce the problem are:

      ------->8---------
      H="Test_Manager"
      ;call udf with the Sample Text as argument
      ^!SetListDelimiter ^%nl%
      ^!SetArray %temp%=^$GetClipText("Sample Text")$
      ;Blank-Line-Delimited Array of text blocks (paragraphs)
      ^!SetListDelimiter ^%nl%^%nl%
      ^!SetArray %article%=^$StripDoubleBlankLines(^%temp%)$


      H="_StripDoubleBlankLines"
      ;allow single blank lines, strip extras from multiples
      ;line 1:
      ^!Set %arg%=^&
      ;line 2:
      ^!Set %arg%=^$StrReplace("^%nl%^%nl%^%nl%";"^%nl%^%nl%";"^%arg%";0;0)$
      ;line 3:
      ^!If ^$StrPos("^%nl%^%nl%^%nl%";"^%arg%";0)$>0 SKIP_-1
      ;line 4:
      ^!Result ^%arg%


      H="Sample Text"
      Line One of sample text with multi blank-line between text groups.


      Line Two of sample text, after two blank lines, which my
      "StripDoubleBlankLines" udf supposed to reduce to one blank line.

      Line Three of sample text, after ONE blank line, which the udf should
      leave untouched.


      Line four of Smaple Text, after Two blank lines, which the UDF is
      supposed to reduce to one blank line.
      ------->8---------
    • Sheri
      ... That s not what is causing the pasting. I believe the problem is that only the first line of temp is making it to the StripDoubleBlankLines clip. Since the
      Message 2 of 9 , Nov 30, 2008
      • 0 Attachment
        --- In ntb-clips@yahoogroups.com, "ebbtidalflats" <ebbtidalflats@...>
        wrote:
        >
        > Hi Y'all,
        >
        > If anyone has a little time between turkey sandwiches, I have a
        > user-defined function (custom function) which under SOME
        > conditions does not execute its code as expected. The clip is
        > below, along with two other clips to call the udf, and feed it. I
        > think it's a bug, but before I report yet another mystery bugs to
        > Fookes software, that they cannot duplicate, I thougt I'd ask
        > here if anyone can actually reproduce this bug.
        >
        > The problem:
        >
        > When I use ^& as argument passer, AND there are more than one
        > line of text in the "Sample Text" clip, the code [^!Set
        > %arg%=^$StrReplace("^%nl%^%nl%^%nl%";"^%nl%^%nl%";"^%arg%";0;0)$]
        > in the clip "StripDoubleBlankLines" pastes the content of the
        > lines AFTER the first group of newlines (1 or more) to the
        > current document.

        That's not what is causing the pasting. I believe the problem is that
        only the first line of temp is making it to the StripDoubleBlankLines
        clip. Since the rest is "bare text" it is getting pasted. NoteTab
        doesn't have multiline command capability and it is expanding the
        variable inline. So you cannot pass multiline data (and calling it an
        array doesn't help).

        Regards,
        Sheri

        >
        > My test clips, that reproduce the problem are:
        >
        > ------->8---------
        > H="Test_Manager"
        > ;call udf with the Sample Text as argument
        > ^!SetListDelimiter ^%nl%
        > ^!SetArray %temp%=^$GetClipText("Sample Text")$
        > ;Blank-Line-Delimited Array of text blocks (paragraphs)
        > ^!SetListDelimiter ^%nl%^%nl%
        > ^!SetArray %article%=^$StripDoubleBlankLines(^%temp%)$
        >
        >
        > H="_StripDoubleBlankLines"
        > ;allow single blank lines, strip extras from multiples
        > ;line 1:
        > ^!Set %arg%=^&
        > ;line 2:
        > ^!Set %arg%=^$StrReplace("^%nl%^%nl%^%nl%";"^%nl%^%nl%";"^%arg%";0;0)$
        > ;line 3:
        > ^!If ^$StrPos("^%nl%^%nl%^%nl%";"^%arg%";0)$>0 SKIP_-1
        > ;line 4:
        > ^!Result ^%arg%
        >
        >
        > H="Sample Text"
        > Line One of sample text with multi blank-line between text groups.
        >
        >
        > Line Two of sample text, after two blank lines, which my
        > "StripDoubleBlankLines" udf supposed to reduce to one blank line.
        >
        > Line Three of sample text, after ONE blank line, which the udf should
        > leave untouched.
        >
        >
        > Line four of Smaple Text, after Two blank lines, which the UDF is
        > supposed to reduce to one blank line.
        > ------->8---------
        >
      • ebbtidalflats
        Thanks Sheri, It never ocurred to me that NoteTab sees the argument as multi-line. Regards, Eb
        Message 3 of 9 , Dec 1, 2008
        • 0 Attachment
          Thanks Sheri,

          It never ocurred to me that NoteTab sees the argument as multi-line.


          Regards,


          Eb



          --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@...> wrote:
          >
          > --- In ntb-clips@yahoogroups.com, "ebbtidalflats" <ebbtidalflats@>
          > wrote:
          > >
          > > The problem:
          > >
          > > When I use ^& as argument passer, AND there are more than one
          > > line of text in the "Sample Text" clip, the code [^!Set
          > > %arg%=^$StrReplace("^%nl%^%nl%^%nl%";"^%nl%^%nl%";"^%arg%";0;0)$]
          >
          > That's not what is causing the pasting. I believe the problem is that
          > only the first line of temp is making it to the StripDoubleBlankLines
          > clip. Since the rest is "bare text" it is getting pasted. NoteTab
          > doesn't have multiline command capability and it is expanding the
          > variable inline. So you cannot pass multiline data (and calling it an
          > array doesn't help).
          >
          > Regards,
          > Sheri
          >
        • Flo
          ... Eb, Sheri, I think one questions was how to use ^& as argument passer . I can t see how anything is passed here at all with... ^!Set %arg%=^& It has
          Message 4 of 9 , Dec 1, 2008
          • 0 Attachment
            --- In ntb-clips@yahoogroups.com, "ebbtidalflats" <ebbtidalflats@...>
            wrote:
            >
            > I have a user-defined function (custom function) which under
            > SOME conditions does not execute its code as expected...
            > When I use ^& as argument passer...

            Eb, Sheri,

            I think one questions was how to use "^& as argument passer". I can't
            see how anything is "passed" here at all with...

            ^!Set %arg%=^&

            It has been said that the ^& token works as a "shorthand for
            preselected text (Sheri in a previous message)". Also it's a
            shorthand for a parameter that is passed over to a sublip (see my
            examples below). But Eb's clip doesn't select anything.

            For me, a working Custom Clip Function -- similar to Eb's concept --
            would be...

            H="Test_Manager"
            ^$StripDoubleBlankLines$

            H="_StripDoubleBlankLines"
            ; long line start
            ^!Set %arg%=^$StrReplace("^%nl%^%nl%^%nl%";"^%nl%^%nl%";"^$GetClipText
            ("Sample Text")$";0;0)$
            ; long line end
            ^!If ^$StrPos("^%nl%^%nl%^%nl%";"^%arg%";0)$>0 SKIP_-1
            ^!Result ^%arg%

            Actually, it's a miracle for me how Eb's concept gets to any output
            at all. Which command in his clip is producing the output of
            paragraph #2 to #3 of the Sample Text clip?

            Flo


            P.S. If I'm not mistaken, these are three examples for the use of ^&

            1. Select any text in a document and display it with...

            ^!Info ^&

            2. Put a preselected word into a Wizard field...

            ^!Set %text%=^?[Select text first=^&]
            ^!Info ^%text%

            3. Pass a parameter over to a subclip...

            ; Start Clip
            ^!Clip "Names" George

            ; Subclip "Names"
            ^!Info The name is ^&
          • Sheri
            ... NoteTab has functions to use and remove tokens. If in Test_Manager you change the call to this: ^!SetArray
            Message 5 of 9 , Dec 1, 2008
            • 0 Attachment
              --- In ntb-clips@yahoogroups.com, "ebbtidalflats" <ebbtidalflats@...>
              wrote:
              >
              > Thanks Sheri,
              >
              > It never ocurred to me that NoteTab sees the argument as multi-line.
              >
              >
              > Regards,
              >
              >
              > Eb

              NoteTab has functions to use and remove tokens.

              If in Test_Manager you change the call to this:

              ^!SetArray %article%="^$StripDoubleBlankLines(^$usetokens(^%temp%)$)$"

              and in ^$StripDoubleBlankLines$ make this change:

              ^!Set %arg%=^$RemoveTokens(^&)$

              I think it will do what you were expecting.

              Regards,
              Sheri
            • Sheri
              ... Hi Flo, That was a misstatement. ^& is not an argument pass-er, it is the argument pass-ed. You can send optional text or data to a clip. If a clip refers
              Message 6 of 9 , Dec 1, 2008
              • 0 Attachment
                --- In ntb-clips@yahoogroups.com, "Flo" <flo.gehrke@...> wrote:
                >
                > --- In ntb-clips@yahoogroups.com, "ebbtidalflats" <ebbtidalflats@>
                > wrote:
                > >
                > > I have a user-defined function (custom function) which under
                > > SOME conditions does not execute its code as expected...
                > > When I use ^& as argument passer...
                >

                Hi Flo,

                That was a misstatement. ^& is not an argument pass-er, it is the
                argument pass-ed.

                You can send optional text or data to a clip. If a clip refers to ^&
                it is getting that optional "argument". If nothing has been explicitly
                sent, it uses selected text in the document.

                For example:

                H="Test Hello"
                ^!Clip "Hello" Flo

                H="Hello"
                ^!InsertText Hello ^&

                Running the test clip would have the same result as running hello clip
                after preselected "Flo" in the current document.

                Regards,
                Sheri
              • Sheri
                ... It is not a command producing the output -- it is the lines of text with no commands that exist in the test clip after expansion of ^%temp% variable.
                Message 7 of 9 , Dec 1, 2008
                • 0 Attachment
                  --- In ntb-clips@yahoogroups.com, "Flo" <flo.gehrke@...> wrote:

                  > Which command in his clip is producing the output of
                  > paragraph #2 to #3 of the Sample Text clip?

                  It is not a command producing the output -- it is the lines of text
                  with no commands that exist in the test clip after expansion of
                  ^%temp% variable.

                  Regards,
                  Sheri
                • ebbtidalflats
                  Thanks, I ll give this a try out of curiosity. I gather you are suggesting that ^& will not stumble over the newlines. On the other hand, using ^%temp% as
                  Message 8 of 9 , Dec 2, 2008
                  • 0 Attachment
                    Thanks, I'll give this a try out of curiosity.

                    I gather you are suggesting that ^& will not stumble over the newlines.

                    On the other hand, using ^%temp% as global variable (no ^&),
                    it works too.


                    Eb

                    --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@...> wrote:
                    >
                    > --- In ntb-clips@yahoogroups.com, "ebbtidalflats" <ebbtidalflats@>
                    > wrote:
                    > >
                    > > Thanks Sheri,
                    > >
                    > > It never ocurred to me that NoteTab sees the argument as multi-line.
                    > >
                    > >
                    > > Regards,
                    > >
                    > >
                    > > Eb
                    >
                    > NoteTab has functions to use and remove tokens.
                    >
                    > If in Test_Manager you change the call to this:
                    >
                    > ^!SetArray %article%="^$StripDoubleBlankLines(^$usetokens(^%temp%)$)$"
                    >
                    > and in ^$StripDoubleBlankLines$ make this change:
                    >
                    > ^!Set %arg%=^$RemoveTokens(^&)$
                    >
                    > I think it will do what you were expecting.
                    >
                    > Regards,
                    > Sheri
                    >
                  • ebbtidalflats
                    Flo, You re right, I did not provide for visible output in the demo. I guess I should have done so to remove ambiguity. The test manager clip stored the
                    Message 9 of 9 , Dec 2, 2008
                    • 0 Attachment
                      Flo,

                      You're right, I did not provide for visible output in the demo.
                      I guess I should have done so to remove ambiguity.

                      The test manager clip stored the output of the UDF in the array
                      variable "article".

                      Whenever the UDF pasted to the current doc, it was an ERROR. Which I
                      wanted to demonstrate.


                      Regards,


                      Eb

                      --- In ntb-clips@yahoogroups.com, "Flo" <flo.gehrke@...> wrote:
                      >
                      > --- In ntb-clips@yahoogroups.com, "ebbtidalflats" <ebbtidalflats@>
                      > wrote:
                      > >
                      > > I have a user-defined function (custom function) which under
                      > > SOME conditions does not execute its code as expected...
                      > > When I use ^& as argument passer...
                      >
                      > Eb, Sheri,
                      >
                      > I think one questions was how to use "^& as argument passer". I can't
                      > see how anything is "passed" here at all with...
                      >
                      > ^!Set %arg%=^&
                      >
                      > It has been said that the ^& token works as a "shorthand for
                      > preselected text (Sheri in a previous message)". Also it's a
                      > shorthand for a parameter that is passed over to a sublip (see my
                      > examples below). But Eb's clip doesn't select anything.
                      >
                      > For me, a working Custom Clip Function -- similar to Eb's concept --
                      > would be...
                      >
                      > H="Test_Manager"
                      > ^$StripDoubleBlankLines$
                      >
                      > H="_StripDoubleBlankLines"
                      > ; long line start
                      > ^!Set %arg%=^$StrReplace("^%nl%^%nl%^%nl%";"^%nl%^%nl%";"^$GetClipText
                      > ("Sample Text")$";0;0)$
                      > ; long line end
                      > ^!If ^$StrPos("^%nl%^%nl%^%nl%";"^%arg%";0)$>0 SKIP_-1
                      > ^!Result ^%arg%
                      >
                      > Actually, it's a miracle for me how Eb's concept gets to any output
                      > at all. Which command in his clip is producing the output of
                      > paragraph #2 to #3 of the Sample Text clip?
                      >
                      > Flo
                      >
                      >
                      > P.S. If I'm not mistaken, these are three examples for the use of ^&
                      >
                      > 1. Select any text in a document and display it with...
                      >
                      > ^!Info ^&
                      >
                      > 2. Put a preselected word into a Wizard field...
                      >
                      > ^!Set %text%=^?[Select text first=^&]
                      > ^!Info ^%text%
                      >
                      > 3. Pass a parameter over to a subclip...
                      >
                      > ; Start Clip
                      > ^!Clip "Names" George
                      >
                      > ; Subclip "Names"
                      > ^!Info The name is ^&
                      >
                    Your message has been successfully submitted and would be delivered to recipients shortly.