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

If Else not working?!

Expand Messages
  • maxgrenkowitz
    Hi There, I had a go at If Else... for 90 minutes now, on the following: ^!If ^$StrPos( $ ; Have$InMe ;False)$ = 0 lblReplace else lblNoReplace The goal:
    Message 1 of 4 , Jul 31, 2003
      Hi There,

      I had a go at If Else... for 90 minutes now, on the following:
      ^!If ^$StrPos("$";"Have$InMe";False)$ = 0 lblReplace else
      lblNoReplace

      The goal: Have$InMe is actually ^%FileName%, but it doesn't matter
      for this case... and would go to lblReplace in case of no Dollar in
      the string, and to lblNoReplace in case the string/file name contains
      a $.

      I have tested, whether the labels exist, IfLabelExist, they do.
      I have tested the StrPos with = 0 lblReplace; and > 0 lblNoReplace,
      meaning without an else part.
      Every time the statement is false, it errors with Syntax Error
      pointing to the line with the above statement (StrPos).

      I could pull my hair out... but can't find the syntax error.

      Who can help?

      Thanks a lot,
      Max
    • Larry Thomas
      ... If there is a trailing space at the end of the If test, the test will look for a label with a space at the end of it and fail. Regards, Larry
      Message 2 of 4 , Jul 31, 2003
        At 03:56 AM 8/1/03 -0000, you wrote:
        >Hi There,
        >
        >I had a go at If Else... for 90 minutes now, on the following:
        >^!If ^$StrPos("$";"Have$InMe";False)$ = 0 lblReplace else
        >lblNoReplace

        If there is a trailing space at the end of the If test, the test will look
        for a label with a space at the end of it and fail.

        Regards,

        Larry
        lrt@... e¿ê
      • Alan C.
        ... the following works for me. tested on Notetab Pro 4.95 H= junk5 ^!Set %tststrng%=^?[choose==not^=string_not|yes^=str$ing_yes] ^!Info ^%tststrng% ^!Goto
        Message 3 of 4 , Jul 31, 2003
          On Fri, 01 Aug 2003 03:56:00 -0000, maxgrenkowitz wrote:
          >Hi There,
          >
          >I had a go at If Else... for 90 minutes now, on the following:
          >^!If ^$StrPos("$";"Have$InMe";False)$ = 0 lblReplace else
          >lblNoReplace

          the following works for me. tested on Notetab Pro 4.95

          H="junk5"
          ^!Set %tststrng%=^?[choose==not^=string_not|yes^=str$ing_yes]
          ^!Info ^%tststrng%
          ^!Goto start
          :notinhere
          ^!Info not found. IMPORTANT: ctrl + alt and click on ok 2 quit
          :start
          ^!If ^$StrPos("$";"^%tststrng%";False)$ = 0 notinhere else yesishere
          :yesishere
          ^!Info hi yes is found. click ok to end
          ;----end

          --
          Alan.
        • maxgrenkowitz
          ... will look ... -- How tough?! THIS WAS IT!! Trailing space! I avoid them, hardly ever have them; this time I got it by copying the original command syntax
          Message 4 of 4 , Jul 31, 2003
            --- In ntb-clips@yahoogroups.com, Larry Thomas <larryt@c...> wrote:

            > >I had a go at If Else... for 90 minutes now, on the following:
            > >^!If ^$StrPos("$";"Have$InMe";False)$ = 0 lblReplace else
            > >lblNoReplace

            > If there is a trailing space at the end of the If test, the test
            will look
            > for a label with a space at the end of it and fail.

            -- How tough?! THIS WAS IT!! Trailing space!
            I avoid them, hardly ever have them; this time I got it by copying
            the original command syntax from the help file, REMmed it out, copied
            and modified to get the syntax right, and must have imported the
            trailing space there... or else... :)

            All is working now!

            Thank you so much!

            Cheers,
            Max
          Your message has been successfully submitted and would be delivered to recipients shortly.