Macros gone from Visual Studio, how do I do my simple text transforms now?

I discovered Macros in Notepad++, and they are perfect for plugging in a gaping hole in my toolbelt.

Every once in a while, I had to transform text data. Maybe I had a comma separated list of values and I wanted to add quotes around them to turn them into a string array? Or I had strange symbols in the beginning of each line and needed to remove those. Rearrange values the same way in multiple lines? The list is endless.

What I did some years ago, is that I put the text in a new file in Visual Studio, recorded a macro to transform a single element of the text (one text item, one line, etc) and position to the beginning of the next. I then stopped recording, and played back the macro to transform all elements.

It worked great! Until someone decided to pull the plug on macros for Visual Studio.

But now I found macros in Notepad++, and they work practically the same way. Start recording, perform one transform, stop recording, playback until entire document transformed.

PS. Yes, sometimes Visual Studio regexes could be used to do simple text transformations. I still prefer the macro recording and playback way.

You may also like...

2 Responses

  1. Macro has been dropped out in recent VS versions. An extensive extension for VS 2008/2010/2012/2013 may deserve a try, Visual Smarter:
    http://visualsmarter.blogspot.com/
    It has already more than 200 widgets and coders.

    • Lenard says:

      Looks like a refactoring tool, and not something that would replace macros. But thanks for the hint anyway, I will take a look at it.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: