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

[Clip] Re: Help with extra lines & spaces

Expand Messages
  • Jody
    Hi Claes, ... My note said I took it out, but appearently something got my attention before I did. The reason why it was working for me was the jump -4. You
    Message 1 of 22 , Nov 3, 1999
    • 0 Attachment
      Hi Claes,

      > - I think your clip would be less ad hoc if you remove the
      > ^!jump -4. It works just as well and is more generic.

      My note said I took it out, but appearently something got my
      attention before I did. The reason why it "was working" for me
      was the jump -4.

      You are right! B no workie. Thanks! I tested that twice though
      befor and saw a line get selected. What was happenning though I
      believe was since it was going -4 on what I was testing (before I
      got to jump_end it was actually searching forward on a line I was
      jumping back to. :( Thanks and good ClipNite. I will look at your
      again tomorrow.

      The two most common elements in the
      universe are hydrogen and stupidity.

      Signed,
      I. Claim Ignorance

      Blessed are they who can laugh at themselves
      for they shall never cease to be amused.

      mailto:CF@...?subject=subscribe
    • Sky-Surfer
      Hiya Jody & Claes, Well, I think we finally have a winner!!! I have learned so very much from both of you - Thank you both for all your help by showing me
      Message 2 of 22 , Nov 3, 1999
      • 0 Attachment
        Hiya Jody & Claes,

        Well, I think we finally have a winner!!! I have learned so very
        much from both of you - Thank you both for all your help by showing
        me various solutions through different eyes...!!! 8-)

        I have tested all of the clips that you both sent to me -
        and even experimented with slightly modifying them to make them more
        applicable for my situation. I have ended up with a clip that
        combines the best of both worlds...!!
        (With a few polishing "touch-ups" by me...)

        For the rest of you reading this, the following clip will basically:

        * Jump to the end of your document
        * Paste the clipboard contents
        --- Here's the tricky part: ---
        * Delete all spaces, tabs, and carriage returns, from the end
        * Add a blank line, a dotted line, and another blank line.


        <--- Copy below this line --->
        H=PerfectPaste@End
        ^!Keyboard CTRL+End CTRL+V
        ^!InsertText ^%NL%^%NL%
        :Loop
        ^!Select -2
        ^!If ^$GetSelection$ = ^%NL% Loop
        ^!Find "a-z0-9".* SBH
        ^!Jump Select_End
        ^!Select +999
        ^!Keyboard Delete
        ^!InsertText ^%NL%^%NL%------------------------------^%NL%^%NL%
        <--- Copy above this line, right --->
        <--- click over the Clipbook and --->
        <--- choose "Add from Clipboard" --->


        NOTE:

        Notice the second command line. (^!InsertText ^%NL%^%NL%)
        I had to add this command to add extra lines here, or else, (if there
        was no extra spaces, tabs, or carriage returns at the end of the
        clipboard) the clip would *not* add the correct spacing or dotted
        line separator at the end.

        Also, for this clip to work smoothly, you must set the document's
        properties to "Trim White Spaces" in the "Document | Properties"
        dialogue box. (Otherwise, if there is an odd number of spaces/tabs
        on the last line with text on it, an unwanted space/tab will remain.)

        -----------------------------------------------------------

        Two more questions for the whizzes:

        -----------------------------------------------------------

        1) Can either of you help explain the depth of the following
        search parameters?

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

        I understand the SBH part. But I am having difficulty figuring out
        the scope of the added "period" & "*". Is this creating a wild-card
        search, and if so, what extra parameter is being added to the search
        besides the a-z & 0-9...??? I ask because my testing so far with
        this "Gem" has been flawless, but until I understand this line
        completely, I won't be able to say it IS flawless... 8-)

        -----------------------------------------------------------

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

        There is *very* little information about this command in NTP's help
        file. Actually, NO mention of Loop except for how to get out of one!
        ;)

        -----------------------------------------------------------

        THANX again for your patience & insight.




        Nothin' Left To Do But...
        SMILE
        SMILE
        SMILE
        :)
      • Claes Gauffin
        Hi Sky-Surfer ... That does not seem quite right. What you should have is a regular expression like this: ^!Find [a-z0-9].* SBHRI which says: search
        Message 3 of 22 , Nov 3, 1999
        • 0 Attachment
          Hi Sky-Surfer

          At 15:01 1999-11-03 -0500, you wrote:

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

          That does not seem quite right. What you should have is a regular expression
          like this:
          ^!Find "[a-z0-9].*" SBHRI

          which says: search silently, backwards, within the current selection, using
          regular expression syntax, ignoring case, for any character between a-z or
          0-9,
          followed by any number of any character.

          Actually, for your purposes I don't think you need the .* part. As soon as
          you find one letter or number you know this is a line that should not be
          deleted. Also, as you may have gathered from the talk Jody and I had,
          backward searching does not work with regular expressions, yet. (We are a
          number of people who quite hope for some polishing of regexps in coming
          releases...)

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

          No. "Loop" in your case is not a command but a label for a position in your
          code where you can jump as a result of testing a condition.

          In your case
          ^!If ^$GetSelection$ = ^%NL% Loop
          tests whether what you have selected is a line break.
          If it is you will continue executing the clip from the position indicated
          by :Loop.
          If it is not you will continue with the next command in the clip (^!Find...)

          Regards /Claes
        • 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 4 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 5 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 6 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 7 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 8 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.