Visual Studio Macros

Dylan Lingelbach (small)One of the areas I'm taking charge in Visual Studio is the Macro system.  We want to make macros rock in the next rev so I'm collecting customer evidence data to figure out how people are using VS macros and what would make them rock (like supporting C#, DLR, etc).  Dylan Lingelbach (face pic -->) is the dev working on macros (aka "VS Scripting") and he's just started a blog about it. 

Do you use VS Macros?  If so, I've got some questions for you...

  1. What do you use VS Macros for?
  2. How often do you use the Macro Recorder, and what for?
  3. Do you think you should be editing macro code inside the same IDE
    (or does the separate IDE for macros make sense)?

Let me tell you what we do know people want:

  1. Be able to program in C# as well as VB.NET, and possibly DLR languages
  2. To use Visual Studio Tools for Applications
  3. More access to the underlying object model

There are a number of other details, but I'd like to hear from you.  Got any feedback?

Comments

  • Anonymous
    August 17, 2007
    The comment has been removed

  • Anonymous
    August 17, 2007
    I use the macro facility frequently.  Currently, my primary use is to produce documentation, but prior to features such as snippets and refactoring making it into VS, I used macros for crude snippets and refactoring operations.  Sometimes I use macros to format ugly code although VS is much better at that than it used to be.  I sometimes use macros to generate some native C++ code when I have to use it - for example, I use them to write skeleton code for a function implementation from the function declaration. I primarily use the macro recorder to discover features of the object model.  That is frequently easier than finding the features via the documentation.  I am perfectly satisfied with VB although C# would be great, too. The same IDE would be nice, too. My main complaint with the current macro facility is that if the macros are not in the designated place, I can't find a way to designate another such as a USB drive.  Let me explain.  I teach at a university.  I give my students a number of macros to use.  The university policy is to "refresh" the system image on every lab computer every night.  Any macros they installed, wrote, recorded, or modified are "gone" each time they return to the lab.   Thank you for having an interest in how we use the macro facility and for being willing to let us tell you about it.

  • Anonymous
    August 29, 2007
    In VS 2005, I haven't used them much due to all of the refactoring improvements.  In VS 2003, I used them constantly to auto-generate parameters from member variables & vice versa. There was also a nuisance feature of my project that intermittently caused a dll locking conflict when I did "Build Solution," so I often used a macro that closed the solution, cleared the bin directory & rebuilt everything. I'm currently writing a macro for VS 2005 that will increment the version # associated with my of CSS & image files so that I can force users who have cached them to download the new versions

  • Anonymous
    September 10, 2007
    The comment has been removed

  • Anonymous
    September 11, 2007
    Chris, Thanks for the feedback!  Wow, lots of stuff here.  We'll check into the Express edition issue, that's a pain.  I agree that you should be able to use other languages, we're working on that.  The object model definately needs better exposure/documentation.  What do you think of editing macros inside VS (not a seperate IDE)?  Then you could use macros on macros.

  • Anonymous
    September 11, 2007
    The comment has been removed

  • Anonymous
    September 11, 2007
    Don, Making macros more portable is something we're looking into.  I agree, being able to move your macros around is important.

  • Anonymous
    September 12, 2007
    The comment has been removed

  • Anonymous
    October 04, 2007
    Macros are not working for me either (anymore). No error message, nothing. I get the busy cursor for a split second, then nothing happens. I don't even have Visual Studio Express installed. So my main suggestion is, to make the Macros system more robust and not have it stop working without at least giving an error message :) Thanks!

  • Anonymous
    October 04, 2007
    The comment has been removed

  • Anonymous
    October 04, 2007
    The comment has been removed

  • Anonymous
    October 04, 2007
    By the way, the balloon can be disabled by adding a dword value named "DontShowMacrosBalloon" (set to 1) underneath HKEY_CURRENT_USERSoftwareMicrosoftVisualStudio8.0. Had to use regmon to work that out. Apparently you could also click the tooltip to disable it, but how are you supposed to do that when it only pops up for a split second, write a macros that spinwaits for a few seconds so the ballon shows for longer? What a joke!

  • Anonymous
    December 02, 2007
    For those suffering from broken macros in Visual Studio 2005 http://support.microsoft.com/kb/928209

  • Anonymous
    December 11, 2007
    its all very well to take surveys about IDEs etc when macros  suddenly no longer even work in VS 2005. I've tried downloading the SP1 etc but no luck. very annoying and another MS incompetence.

  • Anonymous
    December 22, 2007
    My macros also stopped working.  I use them mainly for repetitive formatting / reformatting. I can't stand not having them work. After I installed SP1, the macros will now run but I get the following exception at completion: "Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))"

  • Anonymous
    December 22, 2007
    Turns out it was the comma problem others have reported.  Argh.   The macro I typed had a comma in it.  Once I remove the comma all was fine.  I guess they need a fix for the fix.

  • Anonymous
    January 11, 2008
    The comment has been removed

  • Anonymous
    January 26, 2008
    Ya, I ran into the comma in a macro problem. It is hard to believe that with so many good people, that M$$$$ is so incompetent. It like it seem ALL they care about is MONEY MONEY MONEY. A work around is put another character in like ! than use find and replace after.

  • Anonymous
    February 05, 2008
    I don't think temporary macros ever worked for me for VS 2005 on Vista.  I just installed SP1, and of course that had no effect. Still googling for a solution...

  • Anonymous
    February 15, 2008
    I've been struggling just trying to get basic build related macros work in Visual Studio 2005 SP1.  I have upgraded my project from Visual Studio 6, and all has gone well, except, I've been unable to get our macros run at build time.  We based our process off of: http://support.microsoft.com/kb/237870 And there's seemingly no way to introduce the macro into the build process.

  • Anonymous
    February 16, 2008
    The comment has been removed

  • Anonymous
    February 26, 2008
    I use the macro record very frequently to edit data in initializer lists and to edit test data in input files.  It would be nice to have a button (or command) that marks a word (like CTRL+W) and if it is a number will increment it by one. Another command to decrement would also be nice. Also, a long time ago (pre C++ 6.0), the macro record ran much faster (on much slower computers!).  Could you spend some time making it go faster (perhaps by turning off display update while CTRL+SHIFT+P is held down) or by avoiding OLE/ACTIVE-X/CLI (or whatever has slowed it down between now and then).

  • Anonymous
    February 26, 2008
    I have a whole set of macros I wrote stored in the MyMacros.vsmacros file.  In the past I have simply been able to copy this file to the MyMacros folder on a new PC to transfer them.  After adding back the key mappings everything was great. However now when I try to copy the exact same vsmacros file to a new PC I receive "An Add-In has caused an access violation while sinking on 'ProjectAdded'  Do you wish to terminate the application?". This is a WinXP system running VS2005 SP1.  The vsmacros file has not been touched since the previous time it worked perfectly about 6 months ago. Firstly, why is this occurring and how do I fix it?   Secondly, to answer your original question, please use some sensible format to store Macros such as XML so that at the very least I can read the macro file and recover my entire custom macro collection.

  • Anonymous
    May 05, 2008
    Thanks for the registry entry fixing the recorder playback pop-up balloon... what an annoyance!!!

  • Anonymous
    May 23, 2008
    The suggestion about using a more reasonable format for storing the macro code is a good one. I don't really see a good reason for not storing all the code as ordinary VB code files, the way regular Visual Studio VB project code files are stored. True, you can export them, so as to make recovery easy, but why not store them in that format to begin with? I can't read the .vsmacros file, but it appears to store information other than just the code. Couldn't this additional information be stored in a project file of some sort, separately from the code files?

  • Anonymous
    May 23, 2008
    The comment has been removed

  • Anonymous
    May 23, 2008
    More on integrating the macro environment into the main IDE environment: I think having the macro environment merged into the regular environment would facilitate quick testing of classes, code, statements and so on. I use the macro environment for a lot of testing (partly because the documentation is so poor). I have four large modules consisting of test Subs for various things. I use the macro environment for this because I don't have to stick code I'm experimenting with into a clean-compiling app and have the overhead of having the application compile and start up. The regular immediate window, now that it exists in Visual Studio, is useful, but extremely limited, since it works on individual statements, not procedures. You can't even do loops in the immediate window. It's really just an occasionally handy toy in its current form (VS 2005, for me).

  • Anonymous
    May 27, 2008
    The comment has been removed

  • Anonymous
    December 15, 2008
    i couldn't find the way to auto run macro when vs2005 startup. pls advice

  • Anonymous
    December 16, 2008
    I think Macros are one of the most under appreciated functions that a computer will do. Recording keystrokes, mouse movements and other user actions simply means that you don't have to do something over and over by hand. The reason I don't use them more is that macro recorders are notoriously wonky and hard to use. For example the one in VS 2005 is OK for recording and playback but managing saved macros is akward to the point where I have to re-learn the process every time I use it. Assigning user created macors to keystrokes is not very intuitive either. Finally creating macros is a lot of work and saving them to export to your new version of Visual Studio is no picnic - add it all up and as useful as they are it's just too hard to deal with the various aspects of them. If you want to do VS users a favor create a toolbar that lets them create macos, assign them to keystrokes AND save them. Better yet INTEGRATE THE SAVING OF ALL USER CREATED CONTENT made in VS into one export function - that would include editor settings, inteface layout, file locations AND macros.  

  • my two cents! PG
  • Anonymous
    February 26, 2009
    On the off chance anyone's still reading this ... one thing I'd love to see with macros is to have them stored by themselves in an external file.  I am writing macros for my company.  I check them into source control, and other folks want to check them out and use them. I see a binary file (MyMacros.vsmacros) but since I can't tell what is in it ... I'm probably going to try stomping it on someone elses system and see how it works.  But it'd be awesome to be able to specify a file per macro module and just have that module in source control for easy sharing among co-workers.

  • Anonymous
    March 16, 2009
    Hi, Basically i m using macros for function commenting file header and similar comment tuff. My current issue is the after installing vs2008 with vs2005 the macros were not working then i installed vs2005 Sp1 . It started getting executed butit gives error. The error occurs when i use comma (,) in my macro. I m not sure why this is happening. If you can help me in this.

  • Anonymous
    March 18, 2009
    Hey Khushi, Sounds like you've found a bug.  Please report this using our customer feedback tool that will enter the issue directly into our bug database and will get routed to the right person for review.  See this link for more info... http://blogs.msdn.com/noahc/archive/2007/02/27/your-bugs-are-our-top-priority.aspx