Making a custom User Tool

User tools are a convenient way to quickly access external tools or other applications. In an earlier post, we shared how to implement several¬†Version Control¬†systems in Understand. If you use a different version control system, or want to launch another application, you’ll need to know how to make your own user tools.

Launch an External Application

For example, suppose I want to open the current file in Notepad. First select Tools | Configure User Tools

image

Enter the name you want to appear for your tool, and the executable that is being launched:

image

The parameters section is a little more tricky. What you enter here will vary wildly based on what application you are launching. If you look at the arrow on the right of the parameters checkbox, you will see a list of variables that Understand can pass to another application.

image

In this case we want to pass Notepad the name of the current file, so we select $CurFile

If the application needs a working directory specified, you can set that, and if you would like to specify an icon for the tool, you can select something different than the application. These settings aren’t needed for this tool, so I leave them alone. Likewise there is no command line output and this is not an STI Perl script, so I’ll leave those checkboxes blank.

Finally we need to decide where we want the tool to appear inside of Understand. There are several option.

image
Pop up Menu
Appears anywhere you right click
Main Menu
Appears under Tools | User Tools
Toolbar
Appears in the User Tools Toolbar
image image image

This tool will now open the current file in Notepad. Here are the complete settings.

image

Here are a couple more examples of some basic tools.

Launch Build System

image

 

In this sample I want to launch my Make script. Note the parameter. In this case I don’t want to send it a file name, I want it to ask me what to build. The $Prompt parameters will ask you for input. When I run this tool, it will ask me for my build target, which is what I wanted

image

Then the build output displays in the Understand command window. The great part of building in Understand is that if there are errors, you can simply click on the error message and Understand will jump straight to that line of code in the editor

image

Code Lookup

In this sample, I want to lookup the selected text in MSDN’s library.¬† There are many different ways to do this, but I think I’ll launch firefox with the following parameters:

http://www.google.com/search?q=$CurSelection site:msdn.microsoft.com+OR+site:support.microsoft.com

image

This will search for the current highlighted text with Google on the MSDN site and the support site.

image