To totally unlock this section you need to Log-in
Login
Notepad++ Macros are a powerful tool if well used in large text files, especially configuration files: it is possible to record actions and play them back one or more times.
You can save a lot of time not having to manually repeat the same process over and over.
Notepad++ Macros
This following animation will show you how to use macros. You can find detailed descriptions and step-by-step instructions with pictures below.
In short, first click on Macro menu, then click on Start Recording, do whichever actions are needed, click on Stop Recording and Playback the macro one or more times. If you find your macro well-recorded save it using the Save Current Recorded Macro... option and give it a descriptive name.
In the above example we want to transform an ordered list of names into a comma-separated list we can use in a T-SQL IN operator.
It would not take a lot of time to rewrite this particular list manually, but it takes a fraction of the time using macros, and the more data you work with the more time you save.
Keep in mind that the actions will be played back exactly as they are recorded, so use CTRL to work on words rather than characters. Use CTRL + Arrows to move the caret to the previous or next word.
Use CTRL + SHIFT + Arrows to mark words if you need to copy them. Use CTRL + BACKSPACE or CTRL + DELETE to delete entire words at once instead of using BACKSPACE or DELETE multiple times.
Use HOME and END keys to move the caret to the start or end of a line. It is also a good idea to disable Word Wrap if you’re working on multiple lines.
Place the caret at the start of line 1. Click Start Recording (use either the button on the toolbar or through the menu Macro → Start Recording).
In this picture the following actions have been done and recorded:
- CTRL+DELETE deleted the number 1
- >CTRL+DELETE deleted the dot and spaces
- Single quote added
- END moved the caret to the end of the line
- Single quote and comma added
- DELETE deleted the line break and moved the next line up to the end of the current line
Click Stop Recording (use either the button on the toolbar or through the menu Macro → Stop Recording).
Click Playback (use either the button on the toolbar or through the menu Macro → Playback) to replay the recorded macro once, as shown in this picture.
Click Run a Macro Multiple Times (use either the button on the toolbar or through the menu Macro → Run a Macro Multiple Times) to replay the recorded macro as many times as you specify or until the end of file, as shown in this picture.
Delete the last comma and the list is ready to be pasted into a T-SQL IN operator. In this picture Word Wrap has been enabled again.