automate task question
-
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 -
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:

(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.
-
@Alan-Kilborn
Hi, many thanks - this works like a treat. In fact, I could add the undo to the macro -
@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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login