Nepedia
Back to Discover
Fluent Reader
💻

Macro (computer science)

technology Maturity 11-13 war conflict Next article →

This article covers sensitive topics: war_conflict. Parents can manage visibility in Parental Controls.

A macro is a special rule used in computer programming. It tells a computer how to swap a small input for a larger output. This process of swapping is called macro expansion.

Jedit macro recorder
Jedit macro recorder

When a programmer uses a macro, they turn a tiny bit of text into a big block of code. This makes the job of writing programs much easier. It also helps people avoid making mistakes. Because a small sequence of characters can grow into something huge, these rules are called "macros."

Macros work in many different ways depending on the software. Some macros are very simple and just swap text. For example, in the C programming language, a macro can swap the name PI for the number 3.14159. Other macros are more powerful and use parameters. A parameterized macro can take in new information to change its result. This allows the macro to act a bit like a function. In some languages like Lisp, these macros can even make decisions about what code to create.

Jedit macro recorder
Jedit macro recorder

People have used macros to automate many tasks over the years. Keyboard and mouse macros can record your clicks and typing. Then, the computer can replay those exact movements for you. This is helpful for repetitive work. In the 1980s, programs like SmartKey and SuperKey were very popular. They helped people format things like screenplays automatically. Today, many apps like word processors have these features built right in.

Jedit macro recorder
Jedit macro recorder

There is also a history of how these tools were made. In 1963, Timothy Hart proposed adding macros to the Lisp 1.5 language. This was a big step for how programmers could write code. Later, in the mid-1980s, researchers introduced the idea of hygienic macros. These are special because they prevent accidental errors when different parts of a program meet. Even text editors like Emacs are built mostly out of macros. Emacs was first made using a language called TECO before moving to Lisp.

Jedit macro recorder
Jedit macro recorder

While macros are helpful, they can sometimes cause problems. In some online games, players use macros to do repetitive tasks without any human effort. This can change how the game economy works, so many games forbid it. There are also macro viruses. These are bad programs written in languages like VBA that can hide in documents. In the mid-to-late 1990s, these were a very common type of computer virus. Today, companies like Microsoft use updates and anti-virus programs to stop them.

Jedit macro recorder
Jedit macro recorder
406 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (1)
File:Jedit macro recorder.png
Jedit macro recorder.png
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.