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

[Clip] Demos: ^!If, ^!IfSame, Loops, & Variables

Expand Messages
  • Jody
    Hi Sky-Surfer, Just saw Claes post come in on autocheck when I was getting ready to reply - will send this anyway... Enjoy!-) ... Great! ... UhOh, is Claes
    Message 1 of 22 , Nov 3, 1999
    • 0 Attachment
      Hi Sky-Surfer,

      Just saw Claes' post come in on autocheck when I was getting
      ready to reply - will send this anyway... Enjoy!-)

      > Well, I think we finally have a winner!!!

      Great!

      > ^!Find "a-z0-9".* SBH

      UhOh, is Claes ever gonna jump on you! ;->

      > 1) Can either of you help explain the depth of the following
      > search parameters?
      >
      > ^!Find "a-z0-9".* SBH
      >
      > I understand the SBH part.

      So, you understand "B" in this case stands for "Broke." hahaha!

      > But I am having difficulty figuring out the scope of the added
      > "period" & "*".

      Since I have a hard time still understanding regExp fully I'll save
      that for those that do know it!-)

      > 2) Is the Loop command simply a modified IF/THEN/GOTO
      > command...??

      No, "If" sets up a choice to do one of two things. Well, instead
      of a discussion, try these out. Also see Eric's Demos in his
      SampleCode.clb and Help on ^!If. There are two different
      formats. I normally reserve numbers for ^!If and use ^!IfSame,
      ^!IfDiff for words, but ^!If can be used for words.

      <--- Copy below this line --->
      H="Demo Variables 1"
      ; 11/03/1999, Sojourner@..., jody
      :LoopThis
      ^!Set %TheVariable%=^?{Set "TheVariable" to the value of=}
      ^!Info TheVariable was set to:^p^p"^%TheVariable%"
      ^!Skip Change "TheVariable"?
      ^!Goto Clip
      ^!Goto LoopThis

      :Clip
      ^!Clip "If TheVariable"


      H="_If TheVariable"
      ; 11/03/1999, Continued from "Demo Variables 1"
      :Yeppers!
      ^!Set %If%=^?{Put in what you set TheVariable to=}
      ^!If "^%TheVariable%" = "^%If%" Next Else Oops
      ^!Info "TheVariable" equals "If" as seen below:^p^p"^%TheVariable%" = ^%If%
      ^!Goto Again

      :Oops
      ^!Info "^%If%" was not what "TheVariable" was set to!^p^p"TheVariable" is equal to: "^%TheVariable%"

      :Again
      ^!Skip Try Again?
      ^!Goto End
      ^!Goto Yeppers!


      H="Demo - 1"
      ; 11/03/1999, Sojourner@..., jody
      ^!Set %YourNumber%=^?[Enter a number. You are looking for the number one=_1|]
      ^!If 1 = ^%YourNumber% DoThis else DoThat
      ;...blah, blah, blah...
      :DoThis
      ^!SetWizardTitle ~^$StrFill(" ";40)$ If Demo ^$StrFill(" ";40)$~
      ^!Info [L]Variable %YourNumber% was set to 1.^pYou are at the "DoThis" label; 1 = ^%YourNumber%.^p
      ^!Goto End

      :DoThat
      ^!SetWizardTitle ~^$StrFill(" ";75)$ If Demo ^$StrFill(" ";75)$~
      ^!Info [L]Variable %YourNumber% was set to ^%YourNumber%, but you were looking for 1.^pYou are at the "DoThat" label because %YourNumber% is not equal 1 to ^%YourNumber%.^p

      H="Demo - IfSame"
      ; 11/03/1999, Sojourner@..., jody
      ^!Set %YourWord%=^?[Enter a word. You are looking for the number NoteTab=_NoteTab|]
      ^!IfSame "NoteTab" "^%YourWord%" DoThis else DoThat
      ;...blah, blah, blah...
      :DoThis
      ^!SetWizardTitle ~^$StrFill(" ";40)$ IfSame Demo ^$StrFill(" ";40)$~
      ^!Info [L]Variable %YourWord% was set to NoteTab.^pYou are at the "DoThis" label because:^p"NoteTab" is the same as "^%YourWord%."^p
      ^!Goto End

      :DoThat
      ^!SetWizardTitle ~^$StrFill(" ";40)$ IfSame Demo ^$StrFill(" ";40)$~
      ^!Info [L]Variable %YourWord% was set to "^%YourWord%."^pYou were looking for NoteTab.^pYou are at the "DoThat" label because:^pNoteTab is _not_ the same as "^%YourWord%."^p

      <--- Copy above this line, right --->
      <--- click over the Clipbook and --->
      <--- choose "Add from Clipboard" --->

      > Actually, NO mention of Loop except for how to get out of one!

      H=Demo Loop
      ; 11/03/1999, Sojourner@..., jody
      ^!Set %loopvariable%=^?{How many times do you want to loop?=_3|}
      ^!Set %Count%=0; %Orig%=^%loopvariable%

      :AnyName
      ^!Inc Count
      ^!Info [L]%loopvariable% was set to ^%Orig%.^pLoop count is now ^%Count%.
      ^!If ^%loopvariable% = ^%Count% End else AnyName

      H=Demo - Find Loop
      ; 11/03/1999, Sojourner@..., jody
      ^!SetClipboard NoteTab Pro, NoteTab PRO, NoteTab Pro, NoteTab Std
      ^!Toolbar Paste New
      ^!Set %Found%=0

      :Loop
      ; "blank" was found first pass, search has not started
      ^!SetWizardTitle ^$GetSelection$ was found.
      ^!SetWizardLabel Search backwards for NoteTab Pro (case sensitive)
      ^!Find "^?{Find=NoteTab Pro}" SB
      ^!IfError Info
      ^!IfCancel Cancel
      ^!Inc %Found%
      ^!Goto Loop

      :Info
      ^!Jump 1
      ^!Info [L]NoteTab Pro was found ^%Found% times.

      :Cancel
      ^!Skip Delete test doc?
      ^!Goto End
      ^!Close Discard

      Happy Clip'n!
      Jody

      http://www.sureword.com/notetab

      The NoteTab Clip List...
      mailto:Ntb-Clips-Subscribe@...
      mailto:Ntb-Clips-UnSubscribe@...
    • Jody
      Hi Sky-Surfer and Others, This is long and taken from Help via Wayne s Cross Rerference. I won t be posting it again so hold onto it, or better yet, get his
      Message 2 of 22 , Nov 3, 1999
      • 0 Attachment
        Hi Sky-Surfer and Others,

        This is long and taken from Help via Wayne's Cross Rerference. I
        won't be posting it again so hold onto it, or better yet, get his
        Cross Reference and Granny Kay's Intorduction to Clipbook
        Progaming. The text below is all one line use Join Lines after
        you make is a Clip and start from the ^!Info line. Do the
        copy/right click thing and put it above the Demos I just sent.

        H=Quick If Reference
        ; Kay Roath has a very worthwhile:
        ; Intorduction to Clipbook Progaming for $5.00.
        ; http://able2find.com/notetabclips.shtml
        ; ^!If statements stolen from Wayne's Cross Reference
        ; http://landru.i-link-2.net/wayne/notetab.html

        ^!SetWizardTitle ~^$StrFill(" ";100)$ IfSame Demo ^$StrFill(" ";100)$~
        ^!Info [L]Basically speaking, If comapares two things. If they are the same the NoteTab will go to where you tell it too. If they are different then it goes to the other place you tell it to.^P^P^!If 1 = 1 ThenGoThisLabel esle GoDifferentLabel^P...^P:ThenGoThisLabel^P:GoDifferentLabel^P^PSo, if you set a variable or use something like ^$GetSelection$ for one of the halves of the statement (I ususally put the fixed in the first half looking for the second) ^!If will compare them.^P^P^!If 1 = ^$GetSelection$ ThenGoThisLabel esle GoDifferentLabel^P^PIf the number 2 was selected then NoteTab would go to:^P^P:GoDifferentLabel^P^PIf^P^!If Integer1 <>= Integer2 GoToLabelTrue [ELSE GoToLabelFalse]^P^!If "String1" <>= "String2" GoToLabelTrue [ELSE GoToLabelFalse]^P^PIf the comparison result is true, then jumps to the specified GoToLabelTrue label. If the result is false and the optional ELSE keyword follows the first label name, execution jumps to the specified GoToLabelFalse label; or to the next instruction if the "ELSE" label is not used. If the two values represent numbers then they are compared as numbers, otherwise they are compared as strings. String comparison is case sensitive.^PYou can use the following comparison operators:^P < returns True if left value is smaller than right value^P > returns True if left value is greater than right value^P <> returns True if left value is different from right value^P <= returns True if left value is smaller or equal to right value^P >= returns True if left value is greater or equal to right value^P = returns True if left value is equal to right value^P^PExamples:^PThe following will cause the execution to jump to the label defined as IsTrue:^P^!IF "Apple" <> "Orange" IsTrue ELSE IsFalse^PThe following will cause the execution to jump to the label defined as LabelFalse:^P^!IF 16 < 7 LabelTrue ELSE LabelFalse^P^P^P See topic:^P [Clip Language - Testing Conditions]^P^P See also:^P [:Label]^P [Goto]^P [IfClipExist]^P [IfDiff]^P [IfError]^P [IfFalse]^P [IfFileExist]^P [IfInDateRange]^P [IfInRange]^P [IfPathExist]^P [IfSame]^P [IfTrue]^P [IsAutoIndent]^P [IsClipDoc]^P [IsEmpty]^P [IsFileType]^P [IsFullVersion]^P [IsHtmlDoc]^P [IsLightVersion]^P [IsModified]^P [IsNumber]^P [IsOpen]^P [IsOutlineDoc]^P [IsPasteBoard]^P [IsReadonly]^P [IsUrl]^P [IsWordWrap]^P [Skip]^P [While]^P^P^PIfSame^P^!IfSame "Value1" "Value2" GoToLabelTrue [ELSE GoToLabelFalse]^P^PCompares two string values. The comparison is not case sensitive.^P^PThe following will cause the execution to jump to the label defined as GoToLabelTrue:^P^P ^!IfSame "abc" "ABC" GoToLabelTrue^P^PIfDiff^P^!IfDiff "Value1" "Value2" GoToLabelTrue [ELSE GoToLabelFalse]^P^PCompares two string values. The comparison is not case sensitive.^P^PThe following will cause the execution to skip the next instruction (Skip is a predefined label):^P^P ^!IfDiff "abc" "xyz" Skip^P^PIfTrue^P^!IfTrue Value GoToLabelTrue [ELSE GoToLabelFalse]^P^PIf Value is equal to 1, TRUE, YES, Y, or ON (case insensitive), then jumps to specified label name. Do not use comparison operators with this command; in that case, you should use the ^!If command to do a comparison between two values.^P^PIfTrue^P^!IfTrue Value GoToLabelTrue [ELSE GoToLabelFalse]^P^PIf Value is equal to 1, TRUE, YES, Y, or ON (case insensitive), then jumps to specified label name. Do not use comparison operators with this command; in that case, you should use the ^!If command to do a comparison between two values.^p

        c ya,
        jody

        I can only please one person a day.
        Today is obviously not your day.
        Tomorrow doesn't look good either. 8?D

        http://www.sureword.com/sojourner/
      • Manuel
        How can I count time, by example: 25-11-99 10:00 25-11-99 10:30 I need to know the time between two dates -- Manuel, from Spain manumail@wanadoo.es
        Message 3 of 22 , Nov 26, 1999
        • 0 Attachment
          How can I count time, by example:

          25-11-99 10:00
          25-11-99 10:30

          I need to know the time between two dates
          --
          Manuel, from Spain
          manumail@...
        • Len
          Hi Manuel; When Eric updatd his web site he included a clip I had sent to him that adds or subtracts days and times. The address is
          Message 4 of 22 , Nov 27, 1999
          • 0 Attachment
            Hi Manuel;

            When Eric updatd his web site he included a clip I had sent to
            him that adds or subtracts days and times.
            The address is http://www.notetab.com/clipbooks/calcdt2.zip
            or by page links
            www.notetab.com Libraries | other | Mathematics | calcdt2.zip

            You may be able to modify the clip for your specific purposes.

            I will expand this to caliculate date/time differences when time
            premits, however the clip will be significantly larger and more
            complex.

            Hope the clip helps, Len

            At 07:53 PM 11/26/99 +0100, you wrote:
            >How can I count time, by example:
            >
            >25-11-99 10:00
            >25-11-99 10:30
            >
            >I need to know the time between two dates
            >--
            >Manuel, from Spain
            >manumail@...

            Leonard O. Hargrove, Jr.
            Avionics Systems Engineer
            E-Mail: Len <NoteTabA@...>
          • Manuel
            LEN ... MANUEL Hi, Len, thanks for the url. -- Manuel, from Spain manumail@wanadoo.es
            Message 5 of 22 , Nov 27, 1999
            • 0 Attachment
              LEN
              >When Eric updatd his web site he included a clip I had sent to
              >him that adds or subtracts days and times.
              >The address is http://www.notetab.com/clipbooks/calcdt2.zip

              MANUEL
              Hi, Len, thanks for the url.

              --
              Manuel, from Spain
              manumail@...
            Your message has been successfully submitted and would be delivered to recipients shortly.