Click to See Complete Forum and Search --> : Find and Replace Visual Studio Macro


MrEff
January 9th, 2010, 11:17 PM
I'm trying to write a macro that extends the functionality of the standard search feature in Visual Studio 2008 with .NET 3.0. Here is what I have so far:

Public Module Replacer2
Sub FindSource()
DTE.ExecuteCommand("Edit.FindinFiles")
DTE.Find.FindWhat = "(/// IWallSource)(.*)((\n)(.*))*(/// /IWallSource)"
DTE.Find.Target = vsFindTarget.vsFindTargetSolution
DTE.Find.MatchCase = True
DTE.Find.MatchWholeWord = False
DTE.Find.MatchInHiddenText = True
DTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxRegExpr
DTE.Find.Action = vsFindAction.vsFindActionFindAll
DTE.Find.ResultsLocation = vsFindResultsLocation.vsFindResults1
DTE.Find.Execute()
DTE.Windows.Item("{CF2DDC32-8CAD-11D2-9302-005345000000}").Close()



End Sub

End Module

It works fine as far as it goes, but it shows the results in the output window and I can't figure out how to access them. I need to see what string was actually found in order to figure out what to replace it with.

The point of all this will be to have the macro copy text found in one file into another file that is tagged to receive it. So, I need to find the source text, copy it, find the spot to put it in, then put it there.

Any suggestions on storing/manipulating the actual string that is found by the regex?