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

[Clip] Re: Help with extra lines & spaces

Expand Messages
  • Jody
    Hi Sky-Surfer, ... It went into a loop. (Ctrl+Alt to stop). Perhaps there was Paste Board conflict which I suspect you are using or you might have been using
    Message 1 of 22 , Nov 2, 1999
    • 0 Attachment
      Hi Sky-Surfer,

      > Flashed a million messages in my status bar

      It went into a loop. (Ctrl+Alt to stop). Perhaps there was
      Paste Board conflict which I suspect you are using or you might
      have been using my broke one. :(

      Here is from the other post I was working on when your latest
      came it. Hopefully this will do you. If not, Claes is coming
      on shift after awhile. <bg> I have no problem working on it
      though.

      > In other words: The clip I am looking for will delete all
      > spaces, tabs, and carrage returns from the current cursor
      > position going backwards until text is reached.

      You can take the Jump -4 out if you want. I just didn't see any
      sense in checking lines that obviously we wanted to get rid of.

      ^!Keyboard Ctrl+V Ctrl+End
      ^!Jump -4
      ^!Find "[a-z].*" SBRI
      ^!IfError Next Else Skip_2
      ^!Jump -1
      ^!Goto Skip_-3
      ^!Jump Select_End
      ^!Keyboard Shift+Ctrl+End
      ^!Toolbar Clear All
      ^!InsertText ^p^p----------------------------^p

      If, you are careful to always select the same way so that you
      always have the same amount of lines underneath the text, then
      you could do this replacing nnn with the number:

      ^!Keyboard Ctrl+V Ctrl+End
      ^!Jump -nnn
      ^!Keyboard Shift+Ctrl+End
      ^!Toolbar Clear All
      ^!InsertText ^p^p----------------------------^p

      >> Are the two spaces on blanks lines mandatory for you?
      >
      > No - My whole object here is to get rid of extra spaces & blank
      > lines.

      See my other post about using Trim Blanks. It will get rid of
      all those spaces and save you a lot of work.

      I am curious to why you are get all those ends line that with
      the extra lines (I understand the spaces).

      Bye for now,
      Jody Adair
      Prov. 3:5-7; 4:23

      http://www.sureword.com/sojourner
      http://www.sureword.com/kjb1611
      http://www.sureword.com/notetab
    • Claes Gauffin
      Hi Sky-Surfer, Jody, Here comes the night-shift. Jody, you beat me on the regexp-attempt:-) But when I tried it out, it seemed to me that NTP s somewhat
      Message 2 of 22 , Nov 2, 1999
      • 0 Attachment
        Hi Sky-Surfer, Jody,

        Here comes the night-shift.
        Jody, you beat me on the regexp-attempt:-)
        But when I tried it out, it seemed to me that NTP's somewhat capricious
        regexp feature couldn't handle backward search. Hence I came up with this.

        So, dear Sky-Surfer, here is another one. Beware though, here are regular
        expressions, which is a bit uncharted waters in NTP. You
        know what the old mapmakers wrote when you were at risk of
        sailing off the edge of the world: "Hoc est dragones".

        So, please try it out well before applying in earnest

        Regards /Claes

        ^!KEYBOARD CTRL+End CTRL+V
        :CheckNext
        ^!Select line
        ^!Find "[a-z0-9]" HSIR
        ^!IfError Delete
        ^!Jump text_end
        ^!InsertText ^%NL%-------------------------^%NL%
        ^!Goto exit
        :Delete
        ^!Select line
        ^!Keyboard Backspace
        ^!Goto CheckNext
      • Jody
        Hi Claes, ... Bout time!-) ... I hardly ever use them since I don t know regExp so I forget about them being there. ... It works for me backwards; wonder what
        Message 3 of 22 , Nov 2, 1999
        • 0 Attachment
          Hi Claes,

          > Here comes the night-shift.

          'Bout time!-)

          > Jody, you beat me on the regexp-attempt:-)

          I hardly ever use them since I don't know regExp so I forget
          about them being there.

          > But when I tried it out, it seemed to me that NTP's somewhat
          > capricious regexp feature couldn't handle backward search.

          It works for me backwards; wonder what the difference is. I did
          forget numbers though so this would have failed in mine, but not
          no more!-) Thanks!

          BELOW these contents BEFORE the next line separator
          1.

          Try this again and see if it goes backwards. I took the
          Jump -4 out:

          H=Strip End regExp
          ^!SetScreenUpDate Off
          ^!Keyboard Ctrl+End
          ^!Jump -4
          ^!Find "[a-z0-9].*" SBRI
          ^!IfError Next Else Skip_2
          ^!Jump -1
          ^!Goto Skip_-3
          ^!Jump Select_end
          ^!Keyboard Shift+Ctrl+End
          ^!Toolbar Clear All
          ^!InsertText ^p^p^t--- ^$GetDate(yyyy.mm.dd, hh:nn:ss)$ ---^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/
        • Claes Gauffin
          Hi Jody, I think we have more or less the same solution. You have as usual those careful little details like screenupdate off and time stamp in the separator
          Message 4 of 22 , Nov 3, 1999
          • 0 Attachment
            Hi Jody,

            I think we have more or less the same solution. You have as usual those
            careful little details like screenupdate off and time stamp in the
            separator line. Nice.

            A couple of points:

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

            - With the stubbornness of a cuckoo clock, I insist that find backwards
            does not work with regexp. You are in fact searching forward in your clip.
            Try removing the "B" in your ^!Find, and you will see that it works just as
            beautiful!

            Regards /Claes
          • 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 5 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 6 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 7 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 8 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 9 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 10 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 11 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 12 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.