2012-03-21 63 views
6

是否有一些Visual Studio 2008的AddIn或扩展,允许我运行宏直到文件结尾?我真的很讨厌按住CTRL + SHIFT + P并等待文件到达结尾。运行宏,直到Visual Studio中的文件结尾

+1

你接受不自由的解决方案? (外部编辑器) – Steve 2012-03-28 14:35:51

+0

我不会与外部编辑...因为有一堆甚至免费的替代品,支持这一点。那么Visual Studio 2008绝对不支持运行到文件结尾?!任何人都知道Visual Studio 2010的情况如何? – kape123 2012-03-29 15:57:11

+0

好吧,很高兴知道。下面Cristian的回答非常好。 – Steve 2012-03-29 17:46:28

回答

5

你可以录制宏,然后打开宏IDE(ALT + F11),将预先录制的宏在这样的循环:

Sub TemporaryMacro() 
    selection = DTE.ActiveDocument.Selection() 
    anchorPoint = selection.AnchorPoint.CreateEditPoint 
    selection.EndOfDocument(True) 
    endPoint = selection.BottomPoint.CreateEditPoint() 
    selection.MoveToPoint(anchorPoint) 

    Do While True 
     isEOF = DTE.ActiveDocument.Selection.TopPoint.CreateEditPoint().Line = endPoint.Line 
     If (isEOF) Then 
      Exit Do 
     End If 

     ' Prerecorded macro 
     DTE.ActiveDocument.Selection.Text = " " 
     DTE.ActiveDocument.Selection.LineDown() 
     DTE.ActiveDocument.Selection.CharLeft() 
     ' End of prerecorder macro 

    Loop 
End Sub 
+0

谢谢无论如何 - 我不喜欢答案......但似乎没有比它能做的更好的了。 – kape123 2012-04-08 04:11:35