Bring back Macros
I am amazed you've decided to remove Macros from Visual Studio. Not only are they useful for general programming, but they're a great way to be introduced to the Visual Studio APIs.
If you are unwilling to put in the development time towards them, please release the source code and let the community maintain it as an extension.
I heard only 1% of folks use this feature therefore it was cut from VS 2012. I really need a way to automate things inside the IDE such as creating files. Writing an extension to do this is way too much work. It would take a very long time to payback the dev hours needed to code up an extension. Keep in mind that 1% is only the 1% of folks that chose to opt into having their usage tracked.
Last week I tried to use Macros and I noticed that feature was cutted out from VS11 Beta. So I have to do it through Notepad++ and finally copy the code into VS11.
We are currently reviewing the feasibility of delivering a scripting capability in a future version of Visual Studio. Please continue to offer your comments on what scripting capability we should offer while we research this suggestion.
Tony Goodhew, Program Manager, VS Pro.
I second Tjipke van der Plaats comment: Adding my vote for ctrl-R (record) + (n-times) ctrl-P (playback) and specifically in editor.
Tjipke van der Plaats commented
Adding my vote for ctrl-R (record) + (n-times) ctrl-P (playback) and specifically in editor.
Francis Pierot commented
Scripting would be okay if we can use it to bring back to life the good old ctrl+R -> record / ctrl+P -> play recording feature of Visual Studio which was time-saving in many many many cases.
Features of IDE regarding Scripting:
- assign playing a script to a key
- auto-create a script by recording keys
- delete, duplicate, import/export macros (xml file ?)
Functions featured by script language:
- search / search again
- search / search again in project/solution
- replace / replace again
- replace / replace again in project/solution
- all cursor moves
- all characters input
- all character & word deletion
- redo / undo
- save edited file
- switch to next edited file
- bonus could be : custom dialog box with fields binding to script variables
Thanks for asking, and can't wait for this feature back!
Automating repetitive text editing operations is our primary goal.
Dave Novak commented
As many have already stated, the requirements for tool should include:
1) record/playback keystrokes
2) edit the recorded macros (preferably using any editor)
3) assign the macro to any toolbar button, menu, or accelerator
But let me be clear: this should not be merely a 'dumb' recording of keystrokes; it needs to be smart about dialog boxes and IDE command keys, the same as the macro recorder in VS-2010. Specifically, it needs to record certain keystrokes (such as those tied to the Find command) as IDE commands. Many use the VS-2010 macro recorder to do repetitive text editing operations, which often involves Find and other navigation commands. Honestly, I'd be fine if you just brought back the old system, though I'd also love to see support for .NET languages rather than just VB script.
Thanks for listening! Now get busy and please fix this disaster!
Record-Playback is my primary use, but record-edit-playback is second.
Bill Menees commented
I used the record/playback macro features a lot. Now that they've been dropped from VS 2012, I have to switch over to Notepad++ to use its record/playback features. That works for simple text changes, but I'd rather stay in VS. The previous VS record/playback ability provided a great place to start rapid prototyping of a macro, and then it was easy to change the macro code to do the rest of what I needed.
I used macros for generating code using context awareness (i.e., "smart code snippets"), for reformatting code, and for reconfiguring projects according to our coding standards. My macros for project configuration were nice because they allowed us to use any Microsoft or third party New Project templates and then apply our required standards (e.g., namespace, target framework, post-build event, signing). This also made it simple to update the macros and projects when we upgraded to new versions of VS and .NET.
While it's true that these capabilities can be replaced with extensions (and I have now), the development cost for creating and maintaining extensions is much higher. Extensions require me to deal with packages, resources, .vsct files, .vsixmanifests, and VSIX installation among other things. There is nothing easy or rapid about creating a VS extension when compared to the simplicitiy of a custom macro, which were usually under 100 lines of code. Macros were great because there was no need for compiling, deploying, and/or restarting Visual Studio. They were also simple to deploy to other team members for the same reason; after a Get from source control, everyone was running the latest code. The only downside I ever saw with macros was having to write them in VB.NET instead of C#.
With the power of Roslyn, I would love to see C# macros, and it seems like it would be relatively easy. We shouldn't need to launch another instance of the IDE. We should be able to generate or open a C# macro/script and edit it with IntelliSense in the current IDE. Then it would be nice to be able to debug it in the same instance similar to how we can do XSLT debugging "inline" today (or how the PowerShell ISE can debug open scripts today). If necessary, use a custom file extension like .csxm so the IDE can recognize C# macro files and make them easy to work with (e.g., by providing global DTE, Application, and/or IServiceProvider pointed to the running VS instance).
I'd also like to be able to assign shortcut keys to macros and to be able to use multiple macros files. I'm a VS Pro user, so if you re-add macro support, please make sure it's in the Pro SKU and not just Premium or Ultimate.
I care a lot about C# scripting. I've been maintaining SharpScript (http://www.menees.com/SharpScript.htm) for years, and I love what I see in Roslyn. All the core pieces are there for macros to make an awesome comeback in VS Next. I'd love to see Roslyn's C# Interactive support extended up to full C# macro support.
I had previously turned off the VS usage reporting data because I never thought it would be used to drop a feature I found so important. I leave it on now! Also, on the teams I've worked with, almost no one knew about the record/playback ability until I told them, but once I showed them, they loved it. Maybe it just needed more press.
Thanks for soliciting feedback and for listening!
Eric C. commented
I honestly couldn't believe that the macro function was removed from VS2012 - I mean, why remove a very significant productivity feature even if it was under-advertised and perhaps consequently under-utilized? Isn't an IDE supposed to be all about productivity? How tough could it be for Visual Studio to monitor and detect repetitive keystroke patterns and suggest macro usage? Or to automatically create a macro?
Kevin Ferguson commented
The one feature I use every day and simply can't live without is macro record/replay. I sometimes need to edit the recorded macro too. I'll be sticking with VS2010 until/unless a new VS release includes this feature again.
"Our research shows that only 1% of users [know what the heck they are doing and know how to utilize a powerful IDE to its fullest]". Macros were not really a well advertised feature of VS. Most people I know didn't really know they were there. This is a fault of VS not of the macro system, because those people who do know about them, love them and use them. There are macros for VS all over the place online that do whatever you want them to. Now I love extensions, but I can't for the life of me find extensions that do what I want like I can find macros. They seem to be two different beasts used for two different purposes (read "one is not a replacement for the other"). I also can't record useful things like a pair of glPushMatrix(); glPopMatrix(); calls and place my cursor in between those ready for me to type something, then attach it all to a easy hot key combination. That kind of custom ad hoc code generation can't be found in the built-in code snippets nor as an existing extension, and even if it was, the power of macros comes from the fact that I can define my own and not hope that the makers of VS code the same way I code and therefore added it in already.
What I want, as a consumer of VS since the VB6 days (my very first programming language I learned was VB6, since then I have been programming for 13 years using every new version of VS that comes out and using it for VB, C#, C++/C, ASP.net, glsl (doesn't natively support it, but I love typing in VS so it works), XAML, XML, XNA, and more), is to have a macro system that delivers the same power as the old system with the same ease of use. In fact if the old system can be brought back and shoe-horned in, that would be fine. The flaws of the old system didn't bother me a bit since one you write and polish your macro, you just sit back and enjoy using it. Therefore you just need a simple editor and easy scripting language to quickly write it, test it, polish it, attach a key combination to it, and you're done. I feel like writing my own extension is overkill for this and for what I want most of my macros to do. So in short the new macro system should:
1. Have the ability to record and replay keystrokes like pretty much all other editor macros do.
2. Have the ability to edit that recorded macro in either the main VS editor or a simple stand alone editor.
3. Be able to attach to a custom hot key combination like before.
4. Not require a lot of setup/installation/steep learning curve. Follow the KISS rule (and Occam's razor for that matter), i.e. a simple macro should be simple and quick to produce.
5. Be functionally equivalent or better than the old system, i.e. the set of all macros that could be produced in the old system should be a subset of the new system (no saying things like "oh in the new system you can't do that. But in the next version of VS you can...". sidenote: I get tired of hearing about what the next version of VS can do that somehow wasn't important enough to make it into the one being released.)
Since you asked...
- Record input + IDE commands.
- Any scripting language (functional, OO is overkill). We won't be writing these all+every day, it doesn't matter if it's unfamiliar or even ugly. Most uses would be record, hack, play.
- Please don't over-engineer it (like everything else), then abandon it because it's too much to maintain. For anything beyond IDE automation, we have add-ins.
- No need for an extra IDE, text editor is enough.
- No need for advanced debugging like step-through and variable inspection. TRON-like debugging would be enough.
Nice to have:
- Events such as file new/open/save, pre/post build.
- Access to the current file name/line, selected text.
phil jones commented
Just want to record some key strokes and play them back to save on repetitive typing.
the announcement that Microsoft is considering putting "scripting" back into visual studio has got to be one of the most surprising mails I have ever received.
considering an earlier comment from Microsoft that only 1% of the users seem to want to keep macros this announcement is very interesting.
of course it is probably true that the very 1% that seems to need the macro feature is the group that drives the future.
on my part vs 2008 was the last edition capable of being used in an engineering environment. I see Microsoft moving further and further away from engineering and scientific use of computing and I find this a great shame considering the alternatives.
Daniel Sinclair commented
Incidentally, after macros got removed from VS I think many of us learned a painful lesson. I no longer disable feedback on installation of VS. It's our own fault really - if you don't exercise your right to vote don't complain when you don't like who gets elected. I suspect that the demographic of Macro users probably contains a high saturation of users that nearly always turn feedback off. That'll teach us.
Daniel Sinclair commented
+1 for the record/play feature. That's 99% of what I need from a macro feature to automate repetitive tasks.
My most-used macro was just a little one that was similar to auto-formatting but placed my opening brace and closing brace at the indentation I use, leaving the text caret right where I wanted it.
In other words, a "new" scripting feature should be able to manipulate the open document. Go up or down lines, enter text, new lines and whitespace such as TABs.
Paolo Tedesco commented
The recording feature is the most important.
I would like to be able to write macros in a .net language, I think PowerShell would be great for this.
Damian Coventry commented
As well as general text editing, the recording system MUST record executed IDE commands and opening/closing/accepting dialog boxes and docked windows to be truly useful.
Example IDE commands would be inserting/updating/removing bookmarks and breakpoints.
Example dialog boxes would be Find/replace dialogs.
Example docked windows would be Find results.
Jim Nickerson commented
Tony, though I had learned the now removed system I would be ok with a .net C# macro language.
It must record actions so I can then edit them to do what i need.