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

Selective Editing

Expand Messages
  • flo.gehrke
    Hi all, Would you enjoy a little experiment? The idea is this... Occasionally, I want to do a kind of Selective Editing . That is, not to edit a whole
    Message 1 of 5 , May 18, 2011
    • 0 Attachment
      Hi all,

      Would you enjoy a little experiment? The idea is this...

      Occasionally, I want to do a kind of 'Selective Editing'. That is, not to edit a whole document but selected lines only. So NT should start with creating an outline of lines matching certain search criteria. This outline will provide data for a controlled, deliberate and (normally) manual editing. Finally, NT should automatically replace the old lines in the original document with the edited lines.

      The following clip (possibly) is a new kind of "Clip Presentation". Just copy the whole clip and add it to any clipboard. Start the clip from an empty document and watch NT working. You'll get some explanations and -- from step to step -- press OK to continue.

      The clip will enter a nursery rhyme as sample text -- I hope, John Shotsky will forgive me that "recipe" ;-)


      H="Selective Editing"
      ^!IfSame "^%Start%" "Restore" Restore
      ^!Sound SystemStart
      ^!Delay 10
      Pease porridge hot,
      Pease porridge cold,
      Pease porridge in the pot,
      Nine days old.
      Some like it hot,
      Some like it cold,
      Some like it in the pot,
      Nine days old.
      Pease porridge hot,
      Pease porridge cold,
      Pease porridge in the pot,
      Nine days old.
      Some like it hot,
      Some like it cold,
      Some like it in the pot,
      Nine days old.
      ^!Delay 10
      ^!Info In the following wizard, first choose 'Edit'^PPress OK to continue!
      ^!SetWizardWidth 55
      ^!Goto ^?{Choose action:==_Edit|Restore}
      ^!IfCancel Next
      ^!Menu Edit/Clear All
      ^!Goto End

      :Edit
      ^!Set %Search%=days
      ^!Set %Search%=^?{Enter 'days' as search string:=^%Search%}
      ^!Select All
      ^!KeyboardDelay 50
      ^!Keyboard CTRL+A ALT+M L N #1# ENTER
      ^!Replace "^\x20+" >> "0" AWRS
      ^!SetListDelimiter ^%NL%
      ^!Set %Lines%=^$GetDocMatchAll("^.*^%Search%.*$")$
      ^!Toolbar New Document
      ^%Lines%
      ^!Delay 10
      ^!Info [L]These are the selected lines (with line numbers).^PPress OK and watch NT replacing 'days' in line 0, 12, and 16.
      ^!Replace "^08\.\x20Nine\x20\Kdays" >> "weeks" WRS
      ^!Delay 10
      ^!Replace "^12\.\x20Nine\x20\Kdays" >> "months" WRS
      ^!Delay 10
      ^!Replace "^16\.\x20Nine\x20\Kdays" >> "years" WRS
      ^!Info Now press OK and, from this view, start the clip again!
      ^!Set %Start%=Restore
      ^!Goto End

      :Restore
      ^!Info [L]Now watch NT replacing the old lines in the original^Pdocument with the edited lines^PPress OK to continue!
      ^!Delay 10
      ^!Replace "(?<=\.)\x20(?=\w)" >> "|" WARS
      ^!Replace "\R" >> "|" WARS
      ^!SetListDelimiter |
      ^!SetArray %Re%=^$GetText$
      ^!Close Discard
      ^!Jump Doc_Start
      ^!Set %Nr%=1

      :Loop
      ^!Find "^%Re^%Nr%%.+$" RS
      ^!Inc %Nr%
      ^!InsertText ^%Re^%Nr%%
      ^!Inc %Nr%
      ^!If ^%Nr% > ^%Re0% Out
      ^!Goto Loop

      :Out
      ; Remove remaining line numbers
      ^!Replace "^\d{1,}\.\x20" >> "" WARS
      ^!Jump Doc_Start
      ^!Info Finished!^PI hope you enjoyed this little demo!
      ^!ClearVariables
      ; End of clip


      In case you find it useful -- there is a clean version without explanations below.

      I'll be grateful for any improvement.

      In some way, this idea is derived from an old editor that I'm still using only with regard to this feature. They seem to be out of business but a free demo is still available from http://www.kedit.com/kwdemo.html

      Regards,
      Flo


      Clean version

      ^!SetWizardWidth 55
      ^!Goto ^?{Choose action:==_Edit|Restore}

      :Edit
      ^!Set %Search%=^?{Enter search criteria:}
      ^!Select All
      ^!KeyboardDelay 50
      ^!Keyboard CTRL+A ALT+M L N #1# ENTER
      ^!Replace "^\x20+" >> "0" AWRS
      ^!SetListDelimiter ^%NL%
      ^!Set %Lines%=^$GetDocMatchAll("^.*^%Search%.*$")$
      ^!Toolbar New Document
      ^%Lines%
      ^!Goto End

      :Restore
      ^!Replace "(?<=\.)\x20(?=\w)" >> "|" WARS
      ^!Replace "\R" >> "|" WARS
      ^!SetListDelimiter |
      ^!SetArray %Re%=^$GetText$
      ^!Close Discard
      ^!Jump Doc_Start
      ^!Set %Nr%=1

      :Loop
      ^!Find "^%Re^%Nr%%.+$" RS
      ^!Inc %Nr%
      ^!InsertText ^%Re^%Nr%%
      ^!Inc %Nr%
      ^!If ^%Nr% > ^%Re0% Out
      ^!Goto Loop

      :Out
      ^!Replace "^\d{1,}\.\x20" >> "" WARS
      ^!Jump Doc_Start
      ^!ClearVariables
    • flo.gehrke
      ... It s the same old story: Remove line breaks that Yahoo inserts into longe lines, (in this case, especially into the ^!Info-lines). Flo
      Message 2 of 5 , May 18, 2011
      • 0 Attachment
        --- In ntb-clips@yahoogroups.com, "flo.gehrke" <flo.gehrke@...> wrote:
        >
        > Hi all, Would you enjoy a little experiment? The idea is this...

        It's the same old story: Remove line breaks that Yahoo inserts into longe lines, (in this case, especially into the ^!Info-lines).

        Flo
      • Dave
        Hi would this clip work in notetab std ,the last thing it does is replaces days should the numbers in front change ? THANKYOU DAVE M ... From: flo.gehrke
        Message 3 of 5 , May 19, 2011
        • 0 Attachment
          Hi
          would this clip work in notetab std ,the last thing it does is replaces days
          should the numbers in front change ?
          THANKYOU DAVE M

          ----- Original Message -----
          From: "flo.gehrke" <flo.gehrke@...>
          To: <ntb-clips@yahoogroups.com>
          Sent: Thursday, May 19, 2011 12:38 AM
          Subject: [Clip] Selective Editing


          > Hi all,
          >
          > Would you enjoy a little experiment? The idea is this...
          >
          > Occasionally, I want to do a kind of 'Selective Editing'. That is, not to
          > edit a whole document but selected lines only. So NT should start with
          > creating an outline of lines matching certain search criteria. This
          > outline will provide data for a controlled, deliberate and (normally)
          > manual editing. Finally, NT should automatically replace the old lines in
          > the original document with the edited lines.
          >
          > The following clip (possibly) is a new kind of "Clip Presentation". Just
          > copy the whole clip and add it to any clipboard. Start the clip from an
          > empty document and watch NT working. You'll get some explanations and --
          > from step to step -- press OK to continue.
          >
          > The clip will enter a nursery rhyme as sample text -- I hope, John Shotsky
          > will forgive me that "recipe" ;-)
          >
          >
          > H="Selective Editing"
          > ^!IfSame "^%Start%" "Restore" Restore
          > ^!Sound SystemStart
          > ^!Delay 10
          > Pease porridge hot,
          > Pease porridge cold,
          > Pease porridge in the pot,
          > Nine days old.
          > Some like it hot,
          > Some like it cold,
          > Some like it in the pot,
          > Nine days old.
          > Pease porridge hot,
          > Pease porridge cold,
          > Pease porridge in the pot,
          > Nine days old.
          > Some like it hot,
          > Some like it cold,
          > Some like it in the pot,
          > Nine days old.
          > ^!Delay 10
          > ^!Info In the following wizard, first choose 'Edit'^PPress OK to continue!
          > ^!SetWizardWidth 55
          > ^!Goto ^?{Choose action:==_Edit|Restore}
          > ^!IfCancel Next
          > ^!Menu Edit/Clear All
          > ^!Goto End
          >
          > :Edit
          > ^!Set %Search%=days
          > ^!Set %Search%=^?{Enter 'days' as search string:=^%Search%}
          > ^!Select All
          > ^!KeyboardDelay 50
          > ^!Keyboard CTRL+A ALT+M L N #1# ENTER
          > ^!Replace "^\x20+" >> "0" AWRS
          > ^!SetListDelimiter ^%NL%
          > ^!Set %Lines%=^$GetDocMatchAll("^.*^%Search%.*$")$
          > ^!Toolbar New Document
          > ^%Lines%
          > ^!Delay 10
          > ^!Info [L]These are the selected lines (with line numbers).^PPress OK and
          > watch NT replacing 'days' in line 0, 12, and 16.
          > ^!Replace "^08\.\x20Nine\x20\Kdays" >> "weeks" WRS
          > ^!Delay 10
          > ^!Replace "^12\.\x20Nine\x20\Kdays" >> "months" WRS
          > ^!Delay 10
          > ^!Replace "^16\.\x20Nine\x20\Kdays" >> "years" WRS
          > ^!Info Now press OK and, from this view, start the clip again!
          > ^!Set %Start%=Restore
          > ^!Goto End
          >
          > :Restore
          > ^!Info [L]Now watch NT replacing the old lines in the original^Pdocument
          > with the edited lines^PPress OK to continue!
          > ^!Delay 10
          > ^!Replace "(?<=\.)\x20(?=\w)" >> "|" WARS
          > ^!Replace "\R" >> "|" WARS
          > ^!SetListDelimiter |
          > ^!SetArray %Re%=^$GetText$
          > ^!Close Discard
          > ^!Jump Doc_Start
          > ^!Set %Nr%=1
          >
          > :Loop
          > ^!Find "^%Re^%Nr%%.+$" RS
          > ^!Inc %Nr%
          > ^!InsertText ^%Re^%Nr%%
          > ^!Inc %Nr%
          > ^!If ^%Nr% > ^%Re0% Out
          > ^!Goto Loop
          >
          > :Out
          > ; Remove remaining line numbers
          > ^!Replace "^\d{1,}\.\x20" >> "" WARS
          > ^!Jump Doc_Start
          > ^!Info Finished!^PI hope you enjoyed this little demo!
          > ^!ClearVariables
          > ; End of clip
          >
          >
          > In case you find it useful -- there is a clean version without
          > explanations below.
          >
          > I'll be grateful for any improvement.
          >
          > In some way, this idea is derived from an old editor that I'm still using
          > only with regard to this feature. They seem to be out of business but a
          > free demo is still available from http://www.kedit.com/kwdemo.html
          >
          > Regards,
          > Flo
          >
          >
          > Clean version
          >
          > ^!SetWizardWidth 55
          > ^!Goto ^?{Choose action:==_Edit|Restore}
          >
          > :Edit
          > ^!Set %Search%=^?{Enter search criteria:}
          > ^!Select All
          > ^!KeyboardDelay 50
          > ^!Keyboard CTRL+A ALT+M L N #1# ENTER
          > ^!Replace "^\x20+" >> "0" AWRS
          > ^!SetListDelimiter ^%NL%
          > ^!Set %Lines%=^$GetDocMatchAll("^.*^%Search%.*$")$
          > ^!Toolbar New Document
          > ^%Lines%
          > ^!Goto End
          >
          > :Restore
          > ^!Replace "(?<=\.)\x20(?=\w)" >> "|" WARS
          > ^!Replace "\R" >> "|" WARS
          > ^!SetListDelimiter |
          > ^!SetArray %Re%=^$GetText$
          > ^!Close Discard
          > ^!Jump Doc_Start
          > ^!Set %Nr%=1
          >
          > :Loop
          > ^!Find "^%Re^%Nr%%.+$" RS
          > ^!Inc %Nr%
          > ^!InsertText ^%Re^%Nr%%
          > ^!Inc %Nr%
          > ^!If ^%Nr% > ^%Re0% Out
          > ^!Goto Loop
          >
          > :Out
          > ^!Replace "^\d{1,}\.\x20" >> "" WARS
          > ^!Jump Doc_Start
          > ^!ClearVariables
          >
          >
          >
          >
          > ------------------------------------
          >
          > Fookes Software: http://www.fookes.com/
          > NoteTab website: http://www.notetab.com/
          > NoteTab Discussion Lists: http://www.notetab.com/groups.php
          >
          > ***
          > Yahoo! Groups Links
          >
          >
          >
        • diodeom
          ... Maybe instead of numbering all lines -- unless that s useful for something else -- if just the beginnings of copied lines were flagged in the original doc
          Message 4 of 5 , May 19, 2011
          • 0 Attachment
            Flo wrote:
            >
            > Occasionally, I want to do a kind of 'Selective Editing'. That is, not to edit a whole document but selected lines only.
            > (...)
            > Pease porridge hot,
            > Pease porridge cold,
            > Pease porridge in the pot,
            > Nine days old.
            > (...)
            > ^!Keyboard CTRL+A ALT+M L N #1# ENTER
            > ^!Replace "^\x20+" >> "0" AWRS
            >

            Maybe instead of numbering all lines -- unless that's useful for something else -- if just the beginnings of copied lines were flagged in the original doc with some unique marker, the final loop (which pastes edited lines) could rely just on the top-to-bottom sequence of rapid finds (e.g. "^\*.+") precisely matching the order of array elements (lines) to be inserted.

            I actually like the idea of "perpetual stew" (e.g. bigos); I just somehow cannot manage to make it bad enough -- and enough of it -- to last to its target maturity. :)
          • flo.gehrke
            ... @ Dave ... Sorry, Dave. I haven t got NT Std (but NT Pro 6.2 only) and can t figure out what the problem is with the Std version. I hope someone else could
            Message 5 of 5 , May 20, 2011
            • 0 Attachment
              --- In ntb-clips@yahoogroups.com, "Dave" <dmc43959@...> wrote:...

              @ Dave

              > would this clip work in notetab std ,the last thing it does is
              > replaces days should the numbers in front change ?

              Sorry, Dave. I haven't got NT Std (but NT Pro 6.2 only) and can't figure out what the problem is with the Std version. I hope someone else could explain this...

              @ diodeom

              > Maybe instead of numbering all lines -- unless that's useful
              > for something else -- if just the beginnings of copied lines
              > were flagged in the original doc with some unique marker

              Thanks, diodeom! According with your proposal the clip could look something like...

              ^!SetWizardWidth 55
              ^!Goto ^?{Choose action:==Edit|Restore}

              :Edit
              ^!Set %Search%=^?{Enter search criteria:}
              ^!Replace "^(?=.*^%Search%)" >> "@@@" WARS
              ^!Set %Lines%=^$GetDocListAll("^@@@\K.*^%Search%.*$";$0\r\n)$
              ^!Toolbar New Document
              ^%Lines%
              ^!Goto End

              :Restore
              ^!SetListDelimiter ^%NL%
              ^!SetArray %Re%=^$GetText$
              ^!Close Discard
              ^!Jump Doc_Start
              ^!Set %Nr%=1

              :Loop
              ^!Find "^@@@.+$" RS
              ^!InsertText ^%Re^%Nr%%
              ^!Inc %Nr%
              ^!If ^%Nr% > ^%Re0% End
              ^!Goto Loop

              The concept with line numbers might have two advantages:

              1. You could easily identify the original lines by their number when toggling between the output lines and the source document.

              2. Without numbers the sequence of replacements would get into disorder in case the user removes a complete line (or paragraph) from the output. With numbers the clip will correctly identify the lines to be replaced in any case.

              Anyway, let's leave it to the user which version to choose. It's been just a basic idea for a kind of "Selective Editing"...

              Regards,
              Flo
            Your message has been successfully submitted and would be delivered to recipients shortly.