Skip to main content

Macros in Notepad ++ every developer needs to know about

Macros in Notepad ++   Every developer needs to know about


Hi, Today I am going to write about an interesting feature in Notepad ++ every developer needs to know:  Macros.

Most of the developers know that Notepad++ is a very light-weight and handy tool which does amazing stuff.
For those who do not know,

Notepad++ is a free (as in "free speech" and also as in "free beer") source code editor and Notepad replacement that supports several languages. Running in the MS Windows environment, its use is governed by GPL License.
Based on the powerful editing component ScintillaNotepad++ is written in C++ and uses pure Win32 API and STL which ensures a higher execution speed and smaller program size. By optimizing as many routines as possible without losing user friendliness, Notepad++ is trying to reduce the world carbon dioxide emissions. When using less CPU power, the PC can throttle down and reduce power consumption, resulting in a greener environment.
You can visit the following website for further information and download:
https://notepad-plus-plus.org/


Now, I am writing about this feature because, Few days ago, I was facing an issue of changing the URLs of about 1000 PDFs in a particular master website.

Ofcourse this could not be done manually. So we had a brilliant idea of doing it through Selenium driver present in Java, some brilliant Java Code which I may post some day but not now, Microsoft Excel and Notepad++.

With these, we completed the whole project in two days which was actually expected to be complete in 2 weeks.

Now, Why Macros? OfCourse to do repetitive work

That too in Notepad++? Is it really helpful?  Well, decide for yourself. I am describing a particular scenario:

I will not be posting the original details here. We shall use a dummy example.
Open a new blank file in Notepad++

notepadpp_macro
  1. Hit Start Recording
  2. Do what you need
  3. Hit Stop Recording
  4. Run once or multiple times or until file ends
This is the basic usage of a macro.

Now let us start. 

I go to Wikipedia and Search for list of Cities present in California,

I get the entire list. 

I just copy- paste the list onto our Notepad++

It looks somewhat like: 


Now, we have got a lot of extra data and we need to filter out only the city names and truncate all the extra data.

We can do this in a few seconds.

I place my cursor at the end of the word "Adelanto"

I start recording the Macro from this point.

Then I select all the extra data till the new line.

I delete this data. All this is being recorded in the Macro.

In the next line we will be having "Agoura Hills" and this should not be deleted.

So I press home button, then down arrow, then end button on the keyboard

I stop recording the macro.

Now Run the above macro a 100 times and see . We get only the city names.

Refer to the below video I have compiled:


 This was a small example. In right hands and intelligent brains, this can be a really powerful tool.
So use it wisely my fellow developers.

Comments

Popular posts from this blog

Ancient Vedic Dinacharya (Daily routine)

In all of creation there are no better and more powerful medicines, tools, techniques, methods etc. than to tune in with the rhythm and laws of Divine and Almighty Nature. Ayurveda, hygiene, lifestyle and diet are crucial to good health. To attain good health, Ayurveda prescribes the daily routine and the seasonal regime. The daily regime or routine is called “ Dinacharya ” in Sanskrit. ‘Din’ means 'day' and ‘acharya’ means 'to follow' or 'close to'. According to Ayurveda to maintain a healthy and disease free life one should follow a daily routine or schedule. It is important to follow a daily regime in order to be optimally healthy. Dinacharya is one of the best things that you can do to prevent disease, stay in balance and treat almost every illness. The Ayurvedic Rishis (Saints) considered daily routine to be a stronger healing force than any other medicine. In Sanskrit the daily routine is called the  Dinacharya . Ayurveda recommends that ...

How to activate TaskView with Hot Corners in Windows 10

We have some really productive features in Windows 10. Most notably Task View and Start Menu/Screen But in order to fully realize their potential, I felt that they should be activated by Hot Corners just like in Mac OS. So here are some tweaks to achieve the same. I used: 1.        AutoHotKey : Great program for sending keystrokes. 2.        Hot Corners 2: To activate hot corners. Step 1. Install AutoHotKey: I used it to send keystrokes to the processor. Installation is fairly simple. Step 2: Enter the following script in notepad and save it with an “ .ahk” extension: TaskView.ahk                   Send {LWin Down}{Tab}                   Send {LWin up...

Vidyaranya---FOUNDER OF VIJAYANAGARA EMPIRE

Vidyāraṇya also known as Mādhava Vidyāranya is variously known as being a kingmaker, patron saint and high priest to Harihara Raya I and Bukka Raya I, the founders of the Vijayanagar Empire. He was born to Māyaṇācārya and Śrīmatīdevī in Pampakṣetra (modern day Hampi) in 1268 CE. Another account has it that he was born in Ekasila nagari (modern Warangal). Vidyaranya was an exponent of the Advaita school of philosophy in Hinduism.  He was a Hindu statesman and philosopher who lived at the court of Vijayanagara, the Southern Hindu kingdom.  His younger brother, Shyapa,  was a famous commentator on the Rigveda. Shyapa's commentaries were influenced by and dedicated to Mādhava. Founding of Vijayanagara empire                             Harihara Raya I and Bukka Raya I were two Kannada Hoysala Dynasty Army Chiefs. After the Kakatiyas were defeated by Muslim sultans, Harahara and Bukka were for...