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

help needed with If

Expand Messages
  • Axel Berger
    The following Clip (please delete extra linebreaks) ... ^!Set %varLNK%=^?{Enter a URL one level up=^%varLNK%}; %varCNT%=^?{Enter a description for this
    Message 1 of 6 , Mar 1, 2007
    • 0 Attachment
      The following Clip (please delete extra linebreaks)

      ------------------------------------------------------------------
      ^!Set %varLNK%=^?{Enter a URL one level up=^%varLNK%}; %varCNT%=^?{Enter
      a description for this link=^%varCNT%}; %varOben%=^?{(T=L)Oberste
      Leiste?==Ja|_Nein}
      ^!InsertHtml <P ALIGN="center">^P
      ^!If ^%varOben%="Ja" Oben
      ^!InsertHtml <A HREF="#top">Zum Anfang</A>
      ^!Goto Unten
      :Oben
      ^!InsertHtml <A HREF="#bottom">Zum Seitenende</A>
      :Unten
      ^!InsertHtml     ^P<A
      HREF="^%varLNK%">^%varCNT%</A>^P     ^P<A
      HREF="/index.php">Home & Impressum</A>^P</P>^P^P^&
      ------------------------------------------------------------------

      acts in a funny way. It never executes the first Insert and always
      writes the last lines first. With the default of "Nein" I get:

      ------------------------------------------------------------------
          
      <A HREF="index.htm">Übersicht</A>
          
      <A HREF="/index.php">Home & Impressum</A>
      </P>

      <A HREF="#top">Zum Anfang</A>
      ------------------------------------------------------------------

      and with "Ja" it is

      ------------------------------------------------------------------
          
      <A HREF="index.htm">Übersicht</A>
          
      <A HREF="/index.php">Home & Impressum</A>
      </P>

      <A HREF="#bottom">Zum Seitenende</A>
      ------------------------------------------------------------------

      What is going on here, please, and how do I do it right?

      Danke
      Axel
    • Sheri
      ... Try it as: ^!If ^%varOben% = Ja Oben or ^!IfSame ^%varOben% Ja Oben You can usually infer such problems if you single step your clips using
      Message 2 of 6 , Mar 1, 2007
      • 0 Attachment
        --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
        > ^!If ^%varOben%="Ja" Oben

        Try it as:

        ^!If "^%varOben%"="Ja" Oben

        or

        ^!IfSame "^%varOben%" "Ja" Oben

        You can usually infer such problems if you single step your clips using

        ^!Setdebug on

        at the top.

        Regards,
        Sheri
      • Axel Berger
        Sheri s answer really never turned up in my mailbox. This is what I ... The ^!If itself was in fact fine with and without restating it. But debug turned out a
        Message 3 of 6 , Mar 2, 2007
        • 0 Attachment
          Sheri's answer really never turned up in my mailbox. This is what I
          found through the web interface:

          > Try it as:
          > ^!If "^%varOben%"="Ja" Oben
          > or
          > ^!IfSame "^%varOben%" "Ja" Oben
          > You can usually infer such problems
          > if you single step your clips using
          > ^!Setdebug on
          > at the top.
          > Regards,
          > Sheri

          The ^!If itself was in fact fine with and without restating it. But
          debug turned out a great help. Thanks Sheri, I didn't know about that
          one.

          What in fact happens and is as far as I could find not mentioned
          anywhere in the help is:
          My
          ^!InsertHtml <P ALIGN="center">^P
          not only writes the tag but immediately selects it as a block so the
          next insert will overwrite it. This does not happen when you end the
          instruction with ^& thus:
          ^!InsertHtml <P ALIGN="center">^P^&

          So best make it a firm rule always to use ^!InsertHtml with ^& included.
          I shall.

          Danke
          Axel
        • Sheri
          ... Hi Axel, The ^& code at the end is what causes the autoselection to occur in the first place. That code is shorthand for preselected text (preselected
          Message 4 of 6 , Mar 3, 2007
          • 0 Attachment
            Axel Berger wrote:
            > The ^!If itself was in fact fine with and without restating it. But
            > debug turned out a great help. Thanks Sheri, I didn't know about that
            > one.
            >
            > What in fact happens and is as far as I could find not mentioned
            > anywhere in the help is:
            > My
            > ^!InsertHtml <P ALIGN="center">^P
            > not only writes the tag but immediately selects it as a block so the
            > next insert will overwrite it. This does not happen when you end the
            > instruction with ^& thus:
            > ^!InsertHtml <P ALIGN="center">^P^&
            >
            > So best make it a firm rule always to use ^!InsertHtml with ^& included.
            > I shall.
            >
            > Danke
            > Axel
            >
            Hi Axel,

            The ^& code at the end is what causes the autoselection to occur in the
            first place. That code is shorthand for preselected text (preselected
            prior to executing your clip). You should avoid using it if you don't
            need it.

            Try these (in separate clips) . The first is your originally posted code.

            ^!Set debug on
            ^!Set %varLNK%=^?{Enter a URL one level up=^%varLNK%}; %varCNT%=^?{Enter
            a description for this link=^%varCNT%}; %varOben%=^?{(T=L)Oberste
            Leiste?==Ja|_Nein}
            ^!InsertHtml <P ALIGN="center">^P
            ^!If ^%varOben%="Ja" Oben
            ^!InsertHtml <A HREF="#top">Zum Anfang</A>
            ^!Goto Unten
            :Oben
            ^!InsertHtml <A HREF="#bottom">Zum Seitenende</A>
            :Unten
            ^!InsertHtml     ^P<A
            HREF="^%varLNK%">^%varCNT%</A>^P     ^P<A
            HREF="/index.php">Home & Impressum</A>^P</P>^P^P^&
            ;end of clip

            vs

            ^!Set debug on
            ^!Set %varLNK%=^?{Enter a URL one level up=^%varLNK%}; %varCNT%=^?{Enter
            a description for this link=^%varCNT%}; %varOben%=^?{(T=L)Oberste
            Leiste?==Ja|_Nein}
            ^!InsertHtml <P ALIGN="center">^P
            ^!If ^%varOben%="Ja" Oben
            ^!InsertHtml <A HREF="#top">Zum Anfang</A>
            ^!Goto Unten
            :Oben
            ^!InsertHtml <A HREF="#bottom">Zum Seitenende</A>
            :Unten
            ^!InsertHtml     ^P<A
            HREF="^%varLNK%">^%varCNT%</A>^P     ^P<A
            HREF="/index.php">Home & Impressum</A>^P</P>^P^P
            ;end of clip

            All that's been done in the second one is the ^& has been removed from
            the last line. Now I agree that it's strange that having a ^& on the
            last line affects the behavior of the first line in the clip, but that's
            one of the consequences of using ^&. So my advice is to use ^& only when
            you need to insert preselected text, and then use ^!Jump Select_End's
            after each ^!Insert type command in your clip.

            Regards,
            Sheri

            PS, hope this comes through. Due to missing messages I'm now writing
            through email instead of posting at the web site.
          • Sheri
            ... Wait! Typo, should be ^!Setdebug on, no space between ^!Set and debug. Sorry! Sheri
            Message 5 of 6 , Mar 3, 2007
            • 0 Attachment
              Sheri wrote:
              > ^!Set debug on
              >

              Wait! Typo, should be ^!Setdebug on, no space between ^!Set and debug.
              Sorry!

              Sheri
            • Axel Berger
              ... That s what it says in help for InsertText (found it now) - but with InsertHtml it definitely works the other way round, trust me. ... Hmm, I believe you.
              Message 6 of 6 , Mar 3, 2007
              • 0 Attachment
                Sheri wrote:
                > The ^& code at the end is what causes the autoselection
                > to occur in the first place.

                That's what it says in help for InsertText (found it now) - but with
                InsertHtml it definitely works the other way round, trust me.

                > Now I agree that it's strange that having a ^& on the
                > last line affects the behavior of the first line in the clip,
                > but that's one of the consequences of using ^&.

                Hmm, I believe you. But since having a ^& in every instance of the
                command achieves the same goal for me, I'll leave it as it is for the
                time being. Being able to place the cursor at the end of the whole clip
                is a good thing.

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