Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Aren't both just a set of instructions that get executed by some interpreter? (contrary to a full-fledged program, which runs (gets executed) at some computer system?

share|improve this question

closed as unclear what you're asking by MichaelT, Simon, ChrisF Jan 6 at 21:04

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

3 Answers 3

up vote 5 down vote accepted

Basically the difference is just one of degree. A script tends to be a lot more formally defined, with a well-defined scripting language behind it, while a macro is usually something more simple and ad-hoc. Macros are frequently "recorded" by telling a program "watch everything that I do" and then performing the action, whereas scripts are generally entered as text in the scripting language.

share|improve this answer
2  
Unless the OP is asking about macros such as C preprocessor macros or LISP macros. –  FrustratedWithFormsDesigner Dec 28 '13 at 20:09
    
@Frustrated: Yeah, but from the context it doesn't look like that's what he's asking. –  Mason Wheeler Dec 28 '13 at 21:00

Macros come in different flavors.

The original kind was macros in assembly language, where a group of instructions could be named and each time the name was used the instructions were substituted for the name.

C and C++ also have macros that work this way.

But as with most things in IT, why have one term or one meaning when we can make things more confusing? So some environments (starting with MS Word, I believe) introduced "macros" that were a recorded set of actions.

So there are two kinds of macro. The first gets substituted for the name and then compiled. The second is usually interpreted at runtime by the environment.

share|improve this answer

Macro

The common usage of macros is in software applications, and they originated as a tool to map user input to a different set of user output. The key aspect here is the changing of user input/output at the application level. Since user input tends to be related to keyboards, mouse and other devices. The output changed by the macro was often previously recorded by one of those devices. There are also macros that can be written by the user but the goal is often to yield a desired output.

Script

If macros are to application output, then scripts are to application automation. Scripts are often an application specific programming language that automate tasks for the user. The key here is the role of the user as a programmer, and the fact that users are not programmers. If you categorize scripting languages as those that don't compile, are parsed and easy to use then there are many languages that fit those requirements. I argue that scripting languages are the ones easiest for application users to automate the software with the least amount of programming knowledge. That is how they should be categorized as scripts. Anything that requires specialized knowledge outside the domain of the application is just programming tool.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.