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

Re: [Clip] Questions about Wizard output from INFO and PROMPT

Expand Messages
  • flo.gehrke
    ... OK, but even if we add another ^!Set , the result isn t much convincing. Please test... ^!Set %null%= ^!IfTrue ^$IsEmpty(^%null%)$ Next Else Message ;
    Message 1 of 16 , May 16, 2012
    • 0 Attachment
      --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
      >
      > "flo.gehrke" wrote:
      > > where is the command
      >
      > Now that you made me look closely, there's definitely a ^!Set missing.
      >
      > Axel

      OK, but even if we add another '^!Set', the result isn't much convincing. Please test...

      ^!Set %null%=""
      ^!IfTrue ^$IsEmpty(^%null%)$ Next Else Message
      ; Art's line after adding another '^!Set'
      ^!IfEmpty ^%null% ^!Set %null%='^%null%' (IfEmpty says it is empty) dbl quotes
      ^!Info Value of %null% now is: ^%null%
      ^!Goto End
      :Message
      ^!Info No, %null% isn't empty!

      The infobox displays...

      ' (IfEmpty says it is empty) dbl quotes

      Supposed, that Art tested with that missing '^!Set', this could possibly explain why he got to his (IMHO wrong) results: After that line, '%null%' actually isn't empty any more because he assigned that comment '(IfEmpty says...)' to %null%.

      Regards,
      Flo
    • joy8388608
      ... Wow. Short answer but long appreciation. Thanks, Art, for all time, work and thought you put into this for myself (and others). The quote thing is slightly
      Message 2 of 16 , May 16, 2012
      • 0 Attachment
        --- In ntb-clips@yahoogroups.com, Art Kocsis <artkns@...> wrote:

        > The answer to your other questions is the differing displays
        > are due to somewhat of a morass of conflicting behaviors
        > and treatments of single and double quotes.
        >
        > --------snip
        >
        > ________Test______________ ^!IfEmpty ^!IfFalse ^!IfTrue
        > 1) ^!Set %null%=^%Empty% Yes Yes No
        > 2) ^!Set %null%= (nothing) Yes Yes No
        > 3) ^!Set %null%="" No (?) No No
        > 4) ^!ClearVariable %null% No (!) No No
        > 5) ^!Set %null%=x No No No
        >
        > --------snip
        >
        > And it sure would be nice to have a full set of position options:
        >
        > ^!IfTrue/^IfFalse [EOF|BOF|EOL|BOL].
        >

        Wow. Short answer but long appreciation.
        Thanks, Art, for all time, work and thought you put into this for myself (and others). The quote thing is slightly bizarre, slightly confusing and totally unexpected. Lots more notes going into my private documentation!

        The NULL stuff was also worth noting, surprising and definately worth remembering. Nice testing. I was going to mention the NEXT else SKIP solution, but someone beat me to it.

        ^!IfTrue/^IfFalse [EOF|BOF|EOL|BOL] is on my wishlist, also.

        I know what you mean about not getting other work done :) My other day went into GAWK-land.

        And SetDebug IS my best friend.

        Thanks,
        Joy
      • joy8388608
        ... Yes, it was a great idea, but there were errors in the code. I modified the code by making it easier to understand (well, for me) and added double quotes
        Message 3 of 16 , May 16, 2012
        • 0 Attachment
          --- In ntb-clips@yahoogroups.com, "flo.gehrke" <flo.gehrke@...> wrote:
          >
          > --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@> wrote:
          > >
          > > "flo.gehrke" wrote:
          > > > where is the command
          > >
          > > Now that you made me look closely, there's definitely a ^!Set missing.
          > >
          > > Axel
          >
          > OK, but even if we add another '^!Set', the result isn't much convincing. Please test...
          >
          > ^!Set %null%=""
          > ^!IfTrue ^$IsEmpty(^%null%)$ Next Else Message
          > ; Art's line after adding another '^!Set'
          > ^!IfEmpty ^%null% ^!Set %null%='^%null%' (IfEmpty says it is empty) dbl quotes
          > ^!Info Value of %null% now is: ^%null%
          > ^!Goto End
          > :Message
          > ^!Info No, %null% isn't empty!
          >
          > The infobox displays...
          >
          > ' (IfEmpty says it is empty) dbl quotes
          >
          > Supposed, that Art tested with that missing '^!Set', this could possibly explain why he got to his (IMHO wrong) results: After that line, '%null%' actually isn't empty any more because he assigned that comment '(IfEmpty says...)' to %null%.
          >
          > Regards,
          > Flo
          >

          Yes, it was a great idea, but there were errors in the code.

          I modified the code by making it easier to understand (well, for me) and added double quotes around the value on IfEmpty since the documents call for it even though I don't think that changed anything.

          My results show nothing surprising based on the docs.

          ; NTL V7 beta 9
          ; My results given in comment after each test. Joy.

          ^!ClearVariables

          ^!Set %null%=^%EMPTY%
          ^!IfEmpty "^%null%" ^!Set %A1%=X
          ^!IfFalse ^%null% ^!Set %A2%=X
          ^!IfTrue ^%null% ^!Set %A3%=X
          ; A1=X A2=X A3=

          ;Set %null%= (nothing following the equals sign)
          ^!Set %null%=
          ^!IfEmpty "^%null%" ^!Set %B1%=X
          ^!IfFalse ^%null% ^!Set %B2%=X
          ^!IfTrue ^%null% ^!Set %B3%=X
          ; B1=X B2=X B3=

          ; ^!Set %null%="" (Two double quotes following the equals sign)
          ^!Set %null%=""
          ^!IfEmpty "^%null%" ^!Set %C1%=X
          ^!IfFalse ^%null% ^!Set %C2%=X
          ^!IfTrue ^%null% ^!Set %C3%=X
          ; C1=X C2=X C3=

          ^!ClearVariable %null%
          ^!IfEmpty "^%null%" ^!Set %D1%=X
          ^!IfFalse ^%null% ^!Set %D2%=X
          ^!IfTrue ^%null% ^!Set %D3%=X
          ; D1=X D2=X D3=

          ; ^!Set %null%= (a single space following the equals sign)
          ^!Set %null%=
          ^!IfEmpty "^%null%" ^!Set %E1%=X
          ^!IfFalse ^%null% ^!Set %E2%=X
          ^!IfTrue ^%null% ^!Set %E3%=X
          ;^!Prompt Length of null after setting to one space is ^$StrSize("^%null%")$
          ; Length is zero
          ; E1=X E2=X E3=

          ; ^!Set %null%= (a single space in double quotes following the equals sign)
          ^!Set %null%=" "
          ^!IfEmpty "^%null%" ^!Set %E4%=X
          ^!IfFalse ^%null% ^!Set %E5%=X
          ^!IfTrue ^%null% ^!Set %E6%=X
          ;^!Prompt Length of null after setting to one space is ^$StrSize("^%null%")$
          ; Length is one
          ; E4= E5= E6=

          ; ^!Set %null%=x (a single x character following the equals sign)
          ^!Set %null%=x
          ^!IfEmpty "^%null%" ^!Set %F1%=X
          ^!IfFalse ^%null% ^!Set %F2%=X
          ^!IfTrue ^%null% ^!Set %F3%=X
          ; F1= F2= F3=

          ; ^!Set %null%= (Two single quotes following the equals sign)
          ^!Set %null%=''
          ^!IfEmpty "^%null%" ^!Set %G1%=X
          ^!IfFalse ^%null% ^!Set %G2%=X
          ^!IfTrue ^%null% ^!Set %G3%=X
          ;^!Prompt Length of null after setting to '' is ^$StrSize("^%null%")$
          ; Length is two
          ; G1= G2= G3=

          ; ^!Set %null%= (One space & two double quotes following the equals sign)
          ^!Set %null%= ""
          ^!IfEmpty "^%null%" ^!Set %H1%=X
          ^!IfFalse ^%null% ^!Set %H2%=X
          ^!IfTrue ^%null% ^!Set %H3%=X
          ;^!Prompt Length of null after setting to one space and two double quotes is ^$StrSize("^%null%")$
          ; Length is three
          ; H1= H2= H3=

          ^!Info [L]A1=^%A1% A2=^%A2% A3=^%A3% ^%NL%B1=^%B1% B2=^%B2% B3=^%B3% ^%NL%C1=^%C1% C2=^%C2% C3=^%C3% ^%NL%D1=^%D1% D2=^%D2% D3=^%D3% ^%NL%E1=^%E1% E2=^%E2% E3=^%E3% ^%NL%E4=^%E4% E5=^%E5% E6=^%E6% ^%NL%F1=^%F1% F2=^%F2% F3=^%F3% ^%NL%G1=^%G1% G2=^%G2% G3=^%G3% ^%NL%H1=^%H1% H2=^%H2% H3=^%H3%

          Joy
        • Art Kocsis
          ... Yeah, I realized the ELSE NEXT was unnecessary after I had hit send. I was hoping no one would notice. ;) Too much staring at the screen and following a
          Message 4 of 16 , May 16, 2012
          • 0 Attachment
            At 5/16/2012 02:43 AM, Axel wrote:
            >Art Kocsis wrote:
            > >
            > > ^!IfEmpty %var% SKIP ELSE NEXT
            > > <action>
            >
            >Yes, that's how it's mostly done in my clips, except for the superfluous
            >"ELSE NEXT".

            Yeah, I realized the "ELSE NEXT" was unnecessary after I had hit send.
            I was hoping no one would notice. ;) Too much staring at the screen and
            following a line of logic, then missing the obvious. Duh.

            This has not been my most clear thinking week.

            Art
          • Art Kocsis
            ... Miracles!!! I need a DWIMDI language (Do What I Mean, Damm It!) ... Yes ... The way I thought it should! ;) ... A strange one. ;) ... Another strange one.
            Message 5 of 16 , May 16, 2012
            • 0 Attachment
              At 5/16/2012 05:42 AM, Flo wrote:
              >--- In <mailto:ntb-clips%40yahoogroups.com>ntb-clips@yahoogroups.com, Art
              >Kocsis <artkns@...> wrote:
              > > Actually, that is what I am trying to find out (...)
              > > I wrote a quick clip just to test that one thing and it works.
              > > I extracted my test code from the large test clip and it fails.
              >
              >Also your big test CLB is rather confusing for me. What do you expect from
              >command lines like....
              >
              >^!Info ^!Set %null%="" (Two double quotes following the equals sign)
              >^!Set %null%=""
              >^!Set %null%=^%null%
              >^!IfEmpty ^%null% %null%='^%null%' (IfEmpty says it is empty) dbl quotes
              >^!IfFalse ^%null% %null%='^%null%' (IfFalse says it is empty) dbl quotes
              >^!IfTrue ^%null% %null%='^%null%' (IfTrue says it is not empty) dbl quotes

              Miracles!!! I need a DWIMDI language (Do What I Mean, Damm It!)

              >Isn't that a strange clip code syntax?
              Yes

              >How should this work?
              The way I thought it should! ;)

              >What kind of THEN is following the IF here?
              A strange one. ;)

              >And what kind of ELSE?
              Another strange one.

              >Unsurprisingly, this doesn't show any any plausible results.
              You're right! And in retrospect, especially unsurprising!

              What you saw was a result of a serious lack of sleep and way too many
              hours of testing multitudinous variations of clipcode statements. Did you
              ever play the (very) old text based Dungeons and Dragons and get trapped
              in the "Twisty little passages"? If you did and got out you know how it is!
              That's why all the text is there to try and help keep straight which condition
              is being tested and what led to the bad syntax.

              As Axel pointed out, command statements are valid operands for conditionals
              and that is what I intended. However, the "^!Info " that was supposed to follow
              the first %null% got lost in all the copy and pasting. I didn't catch that and
              the Notetab interpreter didn't even whimper over the bad syntax so I ended
              up misinterpreting the results.

              Monitoring execution with "^!SetDebug On" I can observe the results of NT's
              substitutions and what is actually taking place. Since the behavior of the
              various ^!If tests matched the behavior of a negative result (e.g, ^!IfTrue
              saying this condition is not true), that is how I interpreted the execution.
              The statements defining %null% were there to monitor with SetDebug
              and notice that the double quotes were being discarded and were carried
              over from the larger tests.

              Instead, what was really happening is the invalid syntax was simply being
              ignored and the statements discarded. This is another example of why
              coding and debugging clips is so frustrating and tedious.

              So to try and summarize what really happens (I hope this is finally correct!)

              ^!IfTrue/^!IfFalse ^%var% (or "^%var%") will work correctly IFF (if and only
              if for any non-mathematicians <g>), ^%var% is empty or contains any of
              the allowed true or false values (1, TRUE, YES, Y, ON, 0, FALSE, NO,
              N, or OFF [case insensitive]). It %var% contains anything else the tests
              will be deemed invalid without any feedback and the resultant branch
              taken will be the same as a negative test result.

              In other words, the ^!IfTrue/^!IfFalse ^%var% conditionals will only yield
              reliably valid results IFF %var% contains a valid logical value and the
              syntax is perfect. If %var% contains anything else or if you inadvertently
              get an extra, near impossible to spot space in your code all bets are off
              and you will not be warned.

              Similarly, ^!IfEmpty "^%var%" (or ^%var%) will only return a "Yes" IFF
              %var% is empty. Here a malformed statement (such as forgetting to
              enclose %var% in double quotes), will yield the same valid results as
              a perfectly formed statement. However, an ^!IfNotEmpty test would not.
              I suspect similar behaviors exist for the binary operand ^!If tests but am
              getting burnt out on testing.

              I do feel it is unconscionable that Notetab, unlike most other languages,
              requires such exact and restrictive syntax but there is absolutely no
              emphasis let alone mention of this anywhere in the documentation or
              help files. That was a hard, long and frustrating lesson to learn (and I
              am obviously still learning it).

              I will update the boxnet files to try and stop the promulgation of my
              previous results and to include more and corrected test clips.

              I hope this clears everything up. Sorry for the earlier confusion and any
              extra work I caused.

              Art
            • John Shotsky
              It was not dungeons and dragons, it was Colossal Cave Adventure, and I STILL have a copy! I cleared the whole cave (the 550 point version), after I used graph
              Message 6 of 16 , May 16, 2012
              • 0 Attachment
                It was not dungeons and dragons, it was Colossal Cave Adventure, and I STILL have a copy! I cleared the whole cave (the
                550 point version), after I used graph paper to plot it all out. It took me months, but it was both fun and a lesson in
                problem solving. XYZZY! Plugh! Plover! Fee Fie Foe Foo!
                http://en.wikipedia.org/wiki/Colossal_Cave_Adventure

                Regards,
                John
                RecipeTools Web Site: <http://recipetools.gotdns.com/> http://recipetools.gotdns.com/

                From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Art Kocsis
                Sent: Wednesday, May 16, 2012 19:13
                To: NoteTab-Clips
                Subject: Re: [Clip] Questions about Wizard output from INFO and PROMPT


                At 5/16/2012 05:42 AM, Flo wrote:
                >--- In <mailto:ntb-clips%40yahoogroups.com>ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com> , Art
                >Kocsis <artkns@...> wrote:
                > > Actually, that is what I am trying to find out (...)
                > > I wrote a quick clip just to test that one thing and it works.
                > > I extracted my test code from the large test clip and it fails.
                >
                >Also your big test CLB is rather confusing for me. What do you expect from
                >command lines like....
                >
                >^!Info ^!Set %null%="" (Two double quotes following the equals sign)
                >^!Set %null%=""
                >^!Set %null%=^%null%
                >^!IfEmpty ^%null% %null%='^%null%' (IfEmpty says it is empty) dbl quotes
                >^!IfFalse ^%null% %null%='^%null%' (IfFalse says it is empty) dbl quotes
                >^!IfTrue ^%null% %null%='^%null%' (IfTrue says it is not empty) dbl quotes

                Miracles!!! I need a DWIMDI language (Do What I Mean, Damm It!)

                >Isn't that a strange clip code syntax?
                Yes

                >How should this work?
                The way I thought it should! ;)

                >What kind of THEN is following the IF here?
                A strange one. ;)

                >And what kind of ELSE?
                Another strange one.

                >Unsurprisingly, this doesn't show any any plausible results.
                You're right! And in retrospect, especially unsurprising!

                What you saw was a result of a serious lack of sleep and way too many
                hours of testing multitudinous variations of clipcode statements. Did you
                ever play the (very) old text based Dungeons and Dragons and get trapped
                in the "Twisty little passages"? If you did and got out you know how it is!
                That's why all the text is there to try and help keep straight which condition
                is being tested and what led to the bad syntax.

                As Axel pointed out, command statements are valid operands for conditionals
                and that is what I intended. However, the "^!Info " that was supposed to follow
                the first %null% got lost in all the copy and pasting. I didn't catch that and
                the Notetab interpreter didn't even whimper over the bad syntax so I ended
                up misinterpreting the results.

                Monitoring execution with "^!SetDebug On" I can observe the results of NT's
                substitutions and what is actually taking place. Since the behavior of the
                various ^!If tests matched the behavior of a negative result (e.g, ^!IfTrue
                saying this condition is not true), that is how I interpreted the execution.
                The statements defining %null% were there to monitor with SetDebug
                and notice that the double quotes were being discarded and were carried
                over from the larger tests.

                Instead, what was really happening is the invalid syntax was simply being
                ignored and the statements discarded. This is another example of why
                coding and debugging clips is so frustrating and tedious.

                So to try and summarize what really happens (I hope this is finally correct!)

                ^!IfTrue/^!IfFalse ^%var% (or "^%var%") will work correctly IFF (if and only
                if for any non-mathematicians <g>), ^%var% is empty or contains any of
                the allowed true or false values (1, TRUE, YES, Y, ON, 0, FALSE, NO,
                N, or OFF [case insensitive]). It %var% contains anything else the tests
                will be deemed invalid without any feedback and the resultant branch
                taken will be the same as a negative test result.

                In other words, the ^!IfTrue/^!IfFalse ^%var% conditionals will only yield
                reliably valid results IFF %var% contains a valid logical value and the
                syntax is perfect. If %var% contains anything else or if you inadvertently
                get an extra, near impossible to spot space in your code all bets are off
                and you will not be warned.

                Similarly, ^!IfEmpty "^%var%" (or ^%var%) will only return a "Yes" IFF
                %var% is empty. Here a malformed statement (such as forgetting to
                enclose %var% in double quotes), will yield the same valid results as
                a perfectly formed statement. However, an ^!IfNotEmpty test would not.
                I suspect similar behaviors exist for the binary operand ^!If tests but am
                getting burnt out on testing.

                I do feel it is unconscionable that Notetab, unlike most other languages,
                requires such exact and restrictive syntax but there is absolutely no
                emphasis let alone mention of this anywhere in the documentation or
                help files. That was a hard, long and frustrating lesson to learn (and I
                am obviously still learning it).

                I will update the boxnet files to try and stop the promulgation of my
                previous results and to include more and corrected test clips.

                I hope this clears everything up. Sorry for the earlier confusion and any
                extra work I caused.

                Art



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