Quick web searches

I've used quicksearches in Firefox for ages (and before that the same feature in Netcaptor). For the uninitiated, these allow you to type shortcuts to search engines into the location bar in your browser.

Amongst others, I have Google setup as a quick search in FF. This allows me to type "g opus" into the location bar to search google for "opus", for example. Very handy, saves loading the entire search page first and most search engines lend themselves to this functionality. Firefox (and other browsers) simply let you create a bookmark to the search url for the site in question, using %s as a placeholder for your search terms.

Here's my bookmark properties for the google quick search:

You can see that the keyword is 'g' and the url has '%s' in the place where the search engine requires the search terms.

Using the {dlgstring} argument we can use this idea in Opus. Easily creating a toolbar button or even a global hotkey which will prompt the user for search terms, and then launch their default browser with the results.

<?xml version="1.0"?>
<button display="label" effect="gray">
	<label>Google</label>
	<icon1>84</icon1>
	<function type="normal">
		<instruction>"https://www.google.com/search?q={dlgstring|Enter search term/s}"</instruction>
	</function>
</button>

Alternatively, you may want to search for the selected filename/folder instead of your own typed terms. The following button will use the first selected file or folders name.

<?xml version="1.0"?>
<button display="label" effect="gray">
	<label>Google</label>
	<icon1>84</icon1>
	<function type="normal">
		<instruction>"https://www.google.com/search?q={file}"</instruction>
	</function>
</button>

(Edit: From 12.23.2 and above, replace {file} with {file|urlencode} for better handling of spaces and symbols in file names.)

This method can be used with a lot of different search engines, including:

  • Google Images: https://images.google.com/images?q=%s
  • Wikipedia: https://en.wikipedia.org/wiki/Special:Search?search=%s
  • Dictionary: https://dictionary.reference.com/search?q=%s
  • IMDB: https://www.imdb.com/Find?for=%s&select=All

Probably best suited for floating toolbars or global hotkeys you may find this a quick and easy way to search the internet.

2 Likes

Hello,
This is a good tip indeed, but I got a question. When I want to search for a selected file, it takes both the file name and the extension, this is especially bad for imdb, how can I make it take only the file name and leave the extension.

Change the commands so that the {file} argument has the |noext switch:

"http://www.google.com/search?q={file|noext}"
1 Like

Just add {file|noext}

<?xml version="1.0"?>
<button display="label">
	<label>Google</label>
	<icon1>84</icon1>
	<function type="normal">
		<instruction>&quot;http://www.google.com/search?q={file|noext}&quot;</instruction>
	</function>
</button>

Okay, hard one to describe in subject line...

What I am looking for is an extension to the ones above which are great. I have five types of web searches. I have each one as a separate three button with left-click asking for search terms and right click taking the highlighted term with no file extension.

What I want is a search box where I would type in the search term. When I pressed return it would automatically pass that term to the five search engines and open my default browser (Firefox in my case) with the results displayed in five tabs (i tab for each search engine).

Hopefully this makes sense...

Did I mention that I love DOpus?!

Omnibar does just that.. https://addons.mozilla.org/en-US/firefox/addon/8823

So I think if you install this addon and then use Steve's button and modify it so that opus puts your query in the url bar than it may work.

Thanks OpelOpus. Looks like Omnibar does in fact support the type of thing I'm looking for...except for one thing. HELP!!! I'm a little at a loss as to how to pass the search field term to the location bar in Firefox and invoke Omnibar multi-search engine search...Any advice would be appreciated. Thanks for the heads up about Omnibar, though, Opel.

I guess that's not possible. Firefox doesn't have a command line for that. It accepts only url's. If the url isn't complete it sometimes picks the entry and ads .com after it.
Firefox.exe -search, searches with the default search engine that's no use either..If this addon could open a tab in a chrome page and if you then could add the dglstring it could work.

I'll ask the addon's author if this is possible. Maybe I could make a request for this feature.

Thanks Opel. Much appreciated. I would think that this may be of use to others which is why I am not quite ready to give it up. If you often search for things with different search engines, this would be a valuable addition to your productivity toolbox. Or maybe it's just me... :slight_smile:

Thanks again for the quick replies. Let me know what I can do to help out to find a solution.

Easily done. This does Google and Bing. Add/change search engines as needed:

@set search = {dlgstring|Enter search term}
"https://www.google.com/search?q={$search}"
"https://www.bing.com/search?q={$search}"

Been doing the same for awhile as well...

I like to have whatevers in the clipboard added into the dialog by default by doing something like:

@set search = {dlgstring|Enter search term|{clip}}

You guys rock!!! :smiley:

I knew you'd come through. Thanks. It does exactly what I wanted! Ah, the joys of a great product with a great community...

Thanks again, Steje and Leo.

I personally prefer to use custom commands for this.

For example (Settings->Customize->Commands->User->Add)

  • Command1:
    name = g
    template = query
    tip = google search
    command:
    "C:\Program Files\Opera 9\opera.exe" "https://www.google.com/search?q=&query&
    
  • Command2:
    name = map
    template = query
    tip = google maps search
    command:
    "C:\Program Files\Opera 9\opera.exe" "https://maps.google.com/maps?q=&query&"
    

Next, drop a commands field from (Settings->Customize->Commands->Tools) in your GUI.

Next you can type g or map followed by your query in the command field. E.g.:

g test
g "test query"
map europe
etc...

For meta searches just insert multiple searches into the body of the custom commands.

Is it not possible to copy the selected text in any windows application and perform a Google search via a global key?

I tried the following but is not working:

Clipboard COPY
@set searchterm = {dlgstring|Enter search term|{clip}}
"http://www.google.com/search?q={$searchterm}"

Remove the "Clipboard COPY" line at the beginning of your button. It's trying to copy the selected file/s to the clipboard. The {clip} argument works independantly to the Clipboard command and simply provides any line with the current contents of the clipboard.

Great tip. I had a couple of queries that I hope that someone might clear up for me. :slight_smile:

  1. I managed to get google maps, dictionary, rotten tomatoes and wikipedia working using the technique that caine suggested. However, I can't get the IMDB string to work using the Url that steve suggested. http://www.imdb.com/Find?for=%s&select=All. I think its something to do with the %s.

  2. If entering more than one word, a result is not forthcoming from google unless it is enclosed in quotes. Is it possible to have the search term automatically enclosed in quotes? I tried:

"C:\Program Files\Mozilla Firefox\firefox.exe" "http://www.google.co.uk/search?q="&query&""

However, the second quote doesn't get put in at the end of the search term. Is it to do with having to use some kind of escape character at the end so that the penultimate quote is recognised as a string? I did the try the ' and / character, but neither of them worked. Apologies if this is a v basic question, but my experience of programming is v limited. :blush:

  1. Is it possible to have text (e.g. search box) pre-written within the command box. Once you press the mouse within the box, the text disappears so that you can type the search term?

Cheers! :slight_smile:

  1. The %s is what web browsers use for this type of thing but not what Opus uses. Instead of %s you need to use a code Opus recognises to insert the string you want to search for, like {file} or {clip} or {dlgstring} as in the examples in the thread.

  2. You need to URL-encode the quotes (i.e. use %22 instead of ") since they're in the middle of something that is already quoted:

    "C:\blah\Firefox.exe" "https://www.google.co.uk/search?q=%22moo cow%22"
    
  3. You mean on a toolbar? No, not currently.

Hi! Unfortunately, using %22 did not work. I created the following user command that can be invoked from the command field using g:

"D:\Program Files\Mozilla Firefox\firefox.exe" "http://www.google.co.uk/search?q=%22&quote&%22"

It opens firefox with the following URL:

http://www.google.co.uk/search?q=2&quote&2

Any suggstions would be appreciated. :slight_smile:

Turns out you have to double-up the % symbols, so use %%22 instead of %22.

I doubt those & symbols should be there either, by the way. & is used in URLs to separate arguments and needs to be escaped, like the " characters, if you want to include it in an argument.