Just as the title says, I see a lot of editors touting macro recording as a feature but cannot find a way to take advantage of these functions myself. So what can you use it for? The type where you can record mouse movement and/or keystrokes? Is it really that helpful to people out there? Specifically, I deal with Eclipse which has a number of built in "fill in" functions, so I really don't see what the advantages could be.
Waaaay back I used a macro to make function header/comments. Other than that I have not used them.
Basically you can "automate" tedious things you do often that do not have built in ways to do the tasks you do frequently. It is a flexible way to give lots of power to people so they can work more efficiently.
I use them all the time. Say, for example, I want to go down a list, indenting by 4 and adding a "|* ". In EMACS, I hit C-x (
to start recording, do one example line to see that it's what I want, ending with C-n C-a
to move to the next line, and end the macro with C-x )
. Then C-x e
repeats it line by line, and C-u
number C-x e
does it many times.
I find it very useful in microsoft excel. Rather then having to look through documentation to find every object and function I need to call I can record a macro that does most of what I want, take that code and modify it to give me finer control.
Hello,
In Visual Studio, I use macros for many different purposes. One of the most valuable comes when debugging Windows service. I can use the macro engine to start and then attach to the Windows service which just a click of a button.
Also, sometimes I use custom DEFINES that need to be exploded into code--sort of like C/C++ macros.
Colby Africa
Depends on what you are doing and what language you are work with. As a simple example, right now I am working with a Visual Basic .NET application that has a number of queries in it. I generally do all of my work with queries in Toad, but Visual Basic .NET has an annoying syntax when it comes to long strings, namely:
Public Const SelectData As String = _
"SELECT * " & _
"FROM myTable " & _
"WHERE myField = :SOMETHING"
Since I really don't like editing the queries when I copy them out of the code or pasting them back in, I have some macros that will automatically format or strip the formatting from them.
Also, some of the macros can be used to automate common tasks that you need to do around the IDE while you are working. Any sequence of commands that you see yourself doing often is something that you can turn into a macro and do with just a single click.
I don't use them in Eclipse either. Here's why:
Eclipse has many powerful built-in functions and refactorings. So with code, its not necessary.
Eclipse macros aren't that great. You can record them, but its hard to tweak them and do exactly what you want.
Macros become more useful in things like modifying files that aren't code. For that I tend to use something like vim. Also, you have to actually practice using macros to recognize when they will help.