Quite a while back I’ve wrote an introduction to macros and as you know by now macros is a concept that is known in many software packages (excel for example). This, let’s call it feature, is also available in notepad++. And in this tool, a macro allows you to record certain actions you perform in a text document. Let me show you with a small example.
What I often have to do is to look up the details of a bunch of IDs in the database. The problem is that I get the IDs in the following format:
And they sometimes come with hundreds at the time. The problem is that I have to use these codes in the where clause of SQL statements. This means that there has to be a quote before and after the code and each line should be followed by a comma. You can imagine this is quite the chore when having to do this for 100 codes at the time. But there is a very simple solution using a notepad++ macro.
On the top right of the screen I can see the macro buttons
Before creating the macro, click the first line then to create a new macro, simple press the record (the first one) button. It will seem nothing will happen, but don’t worry, it is recording. What I do next is press the home button, type a ‘, hit the end button, type another ‘ followed by a ,. Next I push the arrow down button and the home button once more. Then I click the stop recording button (the second one). The result is as following:
If you press the fifth and last button, the macro can be saved and assigned to a key combination.
And that is how simple it is :).