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

USHAPAN -- Ancient Water Therapy For Boosting Immunity

Our metabolic system has the capacity to heat up the chilled things entering the stomach, but there is no process to cool down the hot things up to the healthy or normal temperature. Consumption of hot tea, coffee, other drinks or eatables damages the delicate tissues in our tongue, food pipe and the stomach; these give rise to ulcers at times, which might become cancerous, if neglected.  Ayurveda not only cures illness but lifestyle as per Ayurvedic Principles gives better health and avoid all type of illnesses. Ushapana: Water is the nectar on earth.Water taken in the morning half an our,before the sun rising is called holy water.Ths water is named USHAPAN  in Hindi. Though a lot has been written in Indian ancient texts about this simple and cheapest theory of nature ,it is not easy to enumerate.This therapy which can be called as water therapy does not burden the pocket of the poor masses who are unable to spend even for their basic necessities like bread a...

Cryptids that turned out to be real

Top 10 Cryptids That Turned Out to be Real Cryptozoology, the study of “hidden animals”, concerns itself with animals whose existence has not yet been recognized by mainstream science. These animals, known as “cryptids”, are often the stuff of legends, written off as myths or elaborate hoaxes.  Some famous cryptids are Bigfoot, the Loch Ness Monster, and El Chupacabra, all of which remain shrouded in mystery. However, many animals widely recognized today were once among these cryptids. The following ten creatures were once dismissed by science as products of folklore, imagination, or deception, but are now formally recognized as their own species. For the sake of consistency, animals falsely thought to be extinct have not been included (coelacanth, Chacoan Peccary, ivory-billed woodpecker). 10.Devil Bird The Devil Bird, or Ulama, is a frightening horned bird of Sri Lankan folklore. This elusive creature is rarely seen, but is often heard in the form of its...