Start Visual Studio 2008 OR Visual Studio 2010
- From Menu bar select “Tools->Macros->New Macro Project“
- Name the project “MyGoogleSearch“
- Rename the default Module1 to “GoogleSearch” (right click on the module name in the left hand pan, select “Rename”)
- Copy following code and paste into the module body
Sub doGoogleSearch() Dim url As String Dim search As TextSelection = DTE.ActiveDocument.Selection() If search.Text <> "" Then url = "www.google.com/search?q=" + search.Text Else url = "www.google.com/" End If ' Run Command: "firefox.exe -new-tab http://www.google.com" Dim cmd As System.Diagnostics.Process = New System.Diagnostics.Process() cmd.StartInfo.Arguments += " -new-tab " + url cmd.StartInfo.FileName = "firefox" cmd.Start() End Sub
- Build and save your “GoogleSearch” module.
- From menu bar “Tools->Options->Environment->Keyboard“
- In the “Show commands containing:” input textbox, type “Google” (to search your newly created macro).
- Go to the “Press shortcut keys” box, and press F1 and then Assign button
- Press OK.
Select text in your Visual Studio Environment that you want to google and press F1, now google searches for whatever you highlighted.
Your search result will be appeared by open New Tab in Firefox (no matter if firefox is already running ).
enjoy your development and google search interactive format. Save your time of text copy/paste or typing the terms you want to google.
Leave a Reply