• Login
Community
  • Login

automate task question

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 2 Posters 851 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.
  • R
    Ruebezahl11
    last edited by Dec 10, 2022, 1:25 PM

    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

    A 1 Reply Last reply Dec 10, 2022, 1:50 PM Reply Quote 0
    • A
      Alan Kilborn @Ruebezahl11
      last edited by Alan Kilborn Dec 10, 2022, 2:21 PM Dec 10, 2022, 1:50 PM

      @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 .

      R 1 Reply Last reply Dec 10, 2022, 4:02 PM Reply Quote 3
      • R
        Ruebezahl11 @Alan Kilborn
        last edited by Dec 10, 2022, 4:02 PM

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

        A 1 Reply Last reply Dec 10, 2022, 4:13 PM Reply Quote 1
        • A
          Alan Kilborn @Ruebezahl11
          last edited by Dec 10, 2022, 4:13 PM

          @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
          1 out of 4
          • First post
            1/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors