Notepad++ Macros

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.

This is my notepad++ document
2013-08-19 08_21_44-_new  1 - Notepad++

On the top right of the screen I can see the macro buttons
2013-08-19 08_23_50-_new  1 - Notepad++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:

2013-08-19 08_27_15-_new  1 - Notepad++If I now click the run multiple times button (the fourth button) a dialog box will popup and you are prompted to enter how many times you want to run the macro.

2013-08-19 08_29_36-_new  1 - Notepad++Since I need to do this for all the lines in my document I picked “Run until the end of file”


2013-08-19 08_33_34-_new  1 - Notepad++


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 :).


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: