Many popular development environments offer a scripting language or similar method of automating common tasks to make ease life for the developer. The Visual Studio Platform Team has released a new extension for Visual Studio 2013 that will allow developers to record and playback macros from within the editor.
The extension works by storing commands that control Visual Studio directly through the DTE Interface. A recorded macro can be replayed as needed, and can easily be edited within VS2013 like any other JavaScript file. Users also have the ability to assign macros to specific hotkeys, and share recorded macros with other users. (Macros are stored in a user’s local profile: AppData\Local\Microsoft\VisualStudio\12.0\Macros\Macros
.)
There are a number of sample scripts provided with the extension to use and use as a basis for your own scripting. Some of the scripts start simple with by inserting the current date & time while others toggle line numbers or head a header to all C# files in the active solution. Having the source code in hand allows for more complex scenarios to be quickly designed and demonstrates how the extension can do more than just replay user keystrokes.
The extension is available now from the Visual Studio Gallery.
Community comments
...
by Mark N,
Re: ...
by Michael Donkhin,
Adding javascript code to macros
by Richard Drain,
...
by Mark N,
Your message is awaiting moderation. Thank you for participating in the discussion.
Good for .NET devs. You'd think this would have been built into VS.NET years ago (like other IDE's). And would not require JS scripting.
Re: ...
by Michael Donkhin,
Your message is awaiting moderation. Thank you for participating in the discussion.
It was built-in until VS2012. See this: stackoverflow.com/questions/12062515/can-i-reco....
Adding javascript code to macros
by Richard Drain,
Your message is awaiting moderation. Thank you for participating in the discussion.
I use to have some extremely helpful Macros running in the original Macros of VS2010 but those no longer work! I thought I'd try adding similar macros via the extension. I wanted to replace an "InputBox" method using the JavaScript 'prompt' method to get input from the user. How can this be done in the new Macro editor. I put in "var myString = prompt("Input String", "new string here")" and get "Current.js error Line nnn: Object expected". I have trouble with even getting simple string methods to work. I found ALL of the samples to be extremely simple macros compared with the ones we had for code documentation.