Community
    • Login

    automate task question

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 2 Posters 841 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Ruebezahl11R
      Ruebezahl11
      last edited by

      I am currentlly repeating certain set of key strokes all too often…
      Basically, I have a file with a name in each line, followed by whitespace and some info. The sequence is:
      select a range of lines, ctrl-c, scroll to a range of emtpy lines I have set aside,
      paste and then reselect the lines. Next, use find/replace panel to replace all “<space>.” by nothing (in selection is checked) - usually the find/replace panel is still in that condition
      Next, click somewhere in a blank space of the program menu (to deselect find/replace but keep selection), then ctrl-c. The truncated lines are now in the clipboard, ready for another program
      Can I somehow improve that process - the ideal case would be to select a range of lines and then type some shortcat to perform the operation

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @Ruebezahl11
        last edited by Alan Kilborn

        @Ruebezahl11

        Yes, you can automate that.

        • make a selection covering some number of whole lines
        • invoke Replace with Ctrl+h
        • start macro recording (Macro menu)
        • set up the Replace window to look like this:
          7f669d64-e29b-42f2-98f4-e2ec3b921eb0-image.png
          (the important parts are a single space character in Find what, absolutely nothing in Replace with, and In selection checked)
        • press Replace All
        • choose Copy from N++'s Edit menu
        • stop macro recording (Macro menu)
        • save your macro (Macro menu)

        When you run the Macro (it will appear on the Macro menu after you save it), it will de-spacify your selected lines, in-place, and copy them to the clipboard. You just have to manually press Ctrl+z (undo) now to get the original lines back in place. But, your goal of having the de-spacified lines in the clipboard is achieved, with less fuss than you had – probably it goes without saying that you can assign the running of a saved macro to a keycombination of your choice.

        Further detail on working with macros is HERE.

        Ruebezahl11R 1 Reply Last reply Reply Quote 3
        • Ruebezahl11R
          Ruebezahl11 @Alan Kilborn
          last edited by

          @Alan-Kilborn
          Hi, many thanks - this works like a treat. In fact, I could add the undo to the macro

          Alan KilbornA 1 Reply Last reply Reply Quote 1
          • Alan KilbornA
            Alan Kilborn @Ruebezahl11
            last edited by

            @Ruebezahl11 said in automate task question:

            I could add the undo to the macro

            Hmm, when I tried that with my quick experimentation, it didn’t work, but if it works for you, great.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors