How to avoid unextracting when selecting a file/folder from an archive (DO just should search for the name, so no extraction should be necessary)? And how to exclude the extension?
You may need to URL encode the filename, which is best done using scripting. JScript and VBScript have URL encoding functions built in, if I remember correctly, but it's been a while.
function OnClick(data) {
data.func.command.ClearFiles();
var objEnum = new Enumerator(data.func.sourcetab.selected);
while (!objEnum.atEnd()) {
var item = objEnum.item().name_stem; objEnum.moveNext();
var replacePlus = item.replace(/\+/g,"%%2B")
var replaceSpace = replacePlus.replace(/ /g,"+")
var search = replaceSpace.replace(/&/g,"%%26");
data.func.command.RunCommand("http://www.google.com/search?q=" + search);
}
}
Modifying Kundal's script slightly, JScript's encodeURIComponent covers a few more cases ( , / ? : @ & = + $ # although not all are possible in filenames to start with of course).
(The "replace" line is because it needs to double the % characters before running the command.)
function OnClick(data) {
data.func.command.ClearFiles();
var objEnum = new Enumerator(data.func.sourcetab.selected);
while (!objEnum.atEnd()) {
var item = objEnum.item().name_stem; objEnum.moveNext();
var encoded = encodeURIComponent(item);
var search = encoded.replace(/%/g,"%%");
data.func.command.RunCommand("http://www.google.com/search?q=" + search);
}
}