Macros Samples
The Macros IDE includes some sample macros for your study and use. They are located in a node called Samples and are available in either the Macro Explorer or the Macros IDE. The following is a list of the macro samples and a description of what they do.
Provided Samples
-
Accessibility — Contains macros that are used to manipulate the text and display property size and appearance in the Visual Studio.
-
AddDirAsSlnFolder — Imports a folder on disk into a solution folder structure.
-
DevStudio6Editor — This macro project contains macros from the Developer Studio version 6.0 macros sample that have been converted to work in Visual Studio macros. It illustrates how to print all open documents, comment a selected block of code, add revision marks, and more.
-
MakeAddin — Converts a macro project into a Visual Studio Add-in. This project illustrates the structure of an Add-in, how to iterate through all of the projects in a macro and each item in a project, how to use the ItemOperations object to add new project items, how to copy references from one project to another, and more.
-
Utilities — Contains several utility macros that are used by the other sample macros. It illustrates how to save and retrieve window configurations, how to manipulate properties in the Options dialog box, how to iterate through items in a project, and more.
-
VSDebugger — Contains a number of macros that use the Debugger automation model objects to control and manipulate debugging operations. It illustrates how to list the stack in the Command window for each thread running in the current program, list and manipulate breakpoints, list processes and languages supported by the debugger, and more.
-
VSEditor — Creates a notepad-like text editor in Visual Studio, complete with editor functionality such as cut and paste, insert, and so forth. It illustrates how to save a backup of the current document, use the Code automation model to create and manipulate outlined sections, how to navigate through code, how to move and use the insertion point, how to manipulate and format text, and more.
Note A module called EnvironmentEvents is also present in the Sample macro, but EnvironmentEvents is not really a sample; it is there to provide event handlers for other macros. It does illustrate, however, how event handlers are initialized in macros. For more information about this, see How to: Handle Environment Events in Macros.
See Also
Some macros in the DevStudio6Editor module may not work as expected when running on new project types. For example, ToggleCommentStyle will not work when the active document is a Visual C# source code file. This is because the DevStudio6Editor module was changed as little as possible to show compatibility differences between Developer Studio 6 and Visual Studio. Because file types such as Visual C# were created after Developer Studio 6 had shipped, support for this file type was not added to the macros.
To add support for C# in ToggleCommentStyle, find the function named FileType, and change the line of code
if ext = ".rc" Or ext = ".rc2" Then
to be
if ext = ".rc" Or ext = ".rc2" Or ext = ".cs" Then
- 6/6/2006
- Craig Skibo - MSFT