Friday, January 25, 2013

Tip 6.15: You can prompt for arguments when you run an external tool

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



To finish the customization of the external tools, you can check Prompt For Arguments if you need to enter or edit values each time you run the tool.

VSTip6115

So now, if she needs to specify which file she wants Notepad to open, she's prompted for the file name, which is the argument for notepad.exe.

VSTip6115a

And recall that you can set the Initial Directory, where Notepad is going to look for files.

Happy Programming! =)
Posted by Nils-Holger at 12:12 PM with 443 comments.

Thursday, January 24, 2013

Tip 6.14: How the external tools tokens work

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



She has hinted at a few of the external tool tokens, but let's explore a little more. Most of these are self-explanatory and are explored in depth in the documentation, but here she'll give you a high-level overview. You can view the documentation at http://msdn.microsoft.com/en-us/library/ekbzk5f8.aspx. All Item and Current tokens that are available for the Arguments edit box operate on the currently active editor. Note the editor does not need to have focus to be able to work, but it must at least have inactive selection.

VSTip6114

For the Initial Directory edit box, you'll find all the directory tokens, but one in particular to call out is the Binary Directory. Note the Binary Directory option is new for Visual Studio 2008.

VSTip6114a

The Target Directory token targets the obj directory (\obj\Debug\), but if you need the final bits that go into the bin directory (\bin\Debug\), use the Binary Directory token.

Happy Programming! =)
Posted by Nils-Holger at 1:26 PM with 1013 comments.

Wednesday, January 23, 2013

Tip 6.13: You can have your external tool's text displayed in the Output window

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



At the bottom of the External Tools dialog box, you'll see more options for customizing the external tool within the IDE. This tip is about the Use Output Window option. The idea here is you're running a .bat file and you want to track the progress within the IDE. Using the command prompt as the tool, you can set Arguments to something like /C echo $(CurText), which signifies the following:
  • /C, from cmd.exe, carries out the command specified by the string and then terminates.
  • $(CurText) is a token that comes from Visual Studio that represents the currently selected text, displayed as Current Text in the menu.


VSTip6113

Now, when running this external tool with a line of text selected in the editor, the Output window displays the text.

VSTip6113a

Happy Programming! =)
Posted by Nils-Holger at 2:04 PM with 907 comments.