The New DevStudio's Scriptlet Toolbar

Although the wizard is a stand-alone module, it can be integrated with the Developer Studio environment. You do this using the Tools menu. Start by clicking the Tools|Customize menu and select the Tools tab, as shown below.

Add a new item and select the EXE file name that implements it. If necessary, you can choose a predefined argument to pass on its command line. Available choices include the currently selected text, the current directory and various others. From now on, a new item appears on the Tools menu. By clicking on it, we're able to run the scriptlet Wizard from within Developer Studio.

What's interesting in all this, is that any tool registered with the Developer Studio may be executed programmatically as a built-in macro. There's an upper limit, however, on the number of installable tools. Previously, we met the Application.ExecuteCommand method. Using it, we can start an external module too—provided that it is registered as a DevStudio tool. The number of default tools is six, so it's reasonable to assume that scriptlet Wizard will be your seventh. This will be the case if you have installed only Visual C++. The Developer Studio environment is shared by a number of other products—like Visual J++ and Visual InterDev—and so the number of default tools will not be six. The following line of code, therefore, assumes that you have six tools installed and you should alter it accordingly.

Application.ExecuteCommand "UserTool7"

This allows you to run the wizard from within a macro file. This possibility opens up a new way to go. In fact, we can make our wizard interact more closely with the rest of the Developer Studio. For example, it would be nice to have the newly created scriptlet open as a new document in the DevStudio environment.

The best way to accomplish this is by creating an add-in module. However, we don't want to deprive you of the immeasurable pleasure of discovering, on your own, the best and the worst of add-in programming. So we're aiming to find another, equally powerful, approach entirely based on macros and VBScript code.

© 1997 by Wrox Press. All rights reserved.