IDM PowerTips

Integrate Yahoo!, Google, Wikipedia and more with UltraEdit

Have you ever opened a PHP, C/C++, or Java file and wondered what a specific function does? Have you ever opened a text file and googled an unfamiliar technical term or phrase? This tutorial will show you how to access the information you need in your browser by simply highlighting your text in the edit window and clicking your toolbar button.

In our Power Tip “Add a webpage to your toolbar” we looked at how UltraEdit’s powerful custom tool feature provides command line interaction directly from the editor window. This simple yet powerful functionality uncovers a vast array of opportunities to integrate your favorite text editor with your favorite application or webpage.

In this tutorial, we will look dig a little deeper into the possibilities of this feature. We will set up a custom tool to integrate search engines with UltraEdit; specifically to pass selected text in the editor window via the command line to a search query URL in the browser window. Simply put, we will set up a tool to search for selected text on our favorite search engine with the click of a button.

Integrate Your Favorite Search Engine with UltraEdit

In order to follow this tutorial, you will need to understand how to use and configure a custom tool. You can read more about UltraEdit’s custom tools at the following power tips:

Creating user and project tools
Add a web page to your toolbar

To learn more about customizing the toolbar in UltraEdit, please visit the following Power Tip:

Customizing the main toolbar

1. Run a Search on the Search Engine in the Browser Window
In order to set up your tool to interact with the search engine via your browser, you will need to first perform a normal search on your selected search engine from the browser window. Once you have done this, you will need to copy the URL from your browser’s address bar. You will be copying the search URL so you know what to pass along to the command line and where to place your selected text in the search URL itself.

2. Copy the Search URL and Configure Your Tool
Next, you will need to configure a custom tool as described in our Power Tip “add a web page to your toolbar“. For the command line, you would use the copied search URL. In our example, we set up a tool to search Google on Firefox, so our command line looked like the following:

Firefox http://www.google.com/search?q=Unicode

Where “Unicode” is our search term.

Remember, the working directory will be the directory where your browser of choice is installed, and you must call your browser in the command line.

Note: For a list of some command-line parameters for commonly used website search URLs (Yahoo, Dictionary.com, Php.net, etc.) click here.

3. Add the %sel% Parameter to the Tool’s Command Line
The %sel% parameter is a special parameter for configuring tools. When this parameter is included in the command line, UltraEdit will replace it with whatever text is selected in the currently open edit window.

Replace your search term with the UltraEdit parameter %sel%. This will cause UltraEdit to insert the currently-selected word or phrase in the editor window into the command line. Your final command line parameter for a Google search on selected text would look similar to the following:

Firefox http://www.google.com/search?q=%sel%

Note: For more command line variables, click the “Help” button in the Tool Configuration dialog.

Note: If your search query URL includes the ampersand (&) symbol, you’ll need to enclose your command line URL in quotes as shown below:

Firefox “http://www.google.com/search?sitesearch=www.w3schools.com&as_q=%sel%”

Now every time you highlight a word or phrase and click your tool, a browser window will launch with search results for that phrase from your favorite search engine. You can set up a tool to search Google, Wikipedia, Dictionary.com, and more… nearly any search engine you like. The possibilities are endless!

Some Common and Useful Search Engine Query URLs

Here are some command line parameters that we used for search queries on different websites.

Search Engines:

Google: http://www.google.com/search?q=%sel%
Yahoo!: http://search.yahoo.com/search?p=%sel%

Informational:

Wikipedia: http://en.wikipedia.org/wiki/%sel%
Dictionary.com: http://dictionary.reference.com/browse/%sel%
Thesaurus.com: http://thesaurus.reference.com/browse/%sel%
Whois Lookup: http://www.whois.net/whois_new.cgi?d=%sel%
Answers.com: http://www.answers.com/main/ntquery?s=%sel%

Development/Programming:

PHP.net: http://us3.php.net/manual-lookup.php?pattern=%sel%
cplusplus.com: http://www.cplusplus.com/query/search.cgi?q=%sel%
W3 Schools (Javascript/HTML/AJAX and more): “http://www.google.com/search?sitesearch=www.w3schools.com&as_q=%sel%”