Development :  K-Meleon Web Browser Forum
K-Meleon development related discussions. 
Meta engine with combined search and engine selection
Posted by: Justin Saquedosse
Date: February 09, 2005 02:35PM

Voici un autre groupe de macros qui permet de faire fonctionner sur Kméleon un métamoteur de recherche interrogeable éventuellement sur deux termes croisés, chaque moteur s’ouvrant dans un onglet. Pour plus de commodités, j’ai choisi de l’installer sur une barre d’outils.
Pour être franc, je suis tout sauf un spécialiste de l’informatique et tout ça est un bricolage sans doute pas très orthodoxe et certainement un peu lourd pour le fichier Macros, mais enfin , il semble que cela fonctionne.
Pour pouvoir interroger sur deux termes (en l’occurrence des bases bibliographiques), j’utilise la barre d’adresse comme la pemière entrée d’un formulaire et la barre de recherche comme la deuxième.

Voici comment procéder sur un exemple : La peste d’Albert Camus
Clic droit sur « Rech. croisée » pour sélectionner la recherche titre/auteur puis clic droit sur « Livres français » pour sélectionner les sites à interroger.
On tape « peste» dans la barre d’adresse puis on clique sur « Livres français » et après avoir rentré le nom de l’auteur « Camus, Albert » dans la barre de recherche, on peut lancer la requête.
Pour une recherche sur un seul terme ( titre ou ISBN), on le tape dans la barre d’adresse puis clic droit sur « Livres français » et clic sur titre ou ISBN.
Pour trouver les chaines d’interrogation j’ai utilisé la fonction « Extraire les données des moteurs de recherche » qu’on trouve dans divers navigateurs tels que Slimbrowser ou Enigma.. Malheureusement, pour certains sites qui imposent des limitations de session, le raccourci ne marche pas. Quelqu’un de calé la dessus pourrait-il me dire s’il y a moyen de contourner le problème ?

Here is a macros group that allowed to have a metaengine working on K-méleon with possible search on two combined terms, each engines opening itself in a layer. As it ‘s more convenient , I choose to set i tup in a toolbar.
To be honest , I ‘m everything but a technician of computer and all that is rather a doityourself making up that some of you might find heavy for the config files but as it is, it seems to work..
In order to search by two combined terms ( in bibliographic basis in the present case), I use the address bar as the first entry of a form and the search bar as the second entry.
Here is how to proceed with an example :: La peste dÂ’Albert Camus.
Right clic on « Rech. croisée » to select the titre/auteur search then right clic on « Livres » to select the sites to search.
You type « peste» in the address bar then clic on « Livres français » and after writing down the author name « Camus, Albert » in the search bar, you launch the query.
For a one term search (title or ISBN ) you write it in the address bar then right clic on « Livres français » and clic on title or ISBN.
As for getting the query string, I used the « extract the engines data » function that you find in such browser like SlimBrowser or Enigma. Unhappily, some sites put sessions limits that make the short cut unavailable. Someone very bright at the subject could tell me whether there is a trick to bypass this problem ?

Here are the macros to add in Macros.cfg , Menus.cfg, Pref.js et Toolbars.cfg :

dans le fichier macros.cfg rajouter d'abord &SetCH à la fin de la macro GetSetTemp (pour conserver les sélections d'une session à l'autre)

Puis toujours dans MACROS :

$a1="Amazon";$a2="Abebooks";$a3="BooksOnDemand";
$a11="Chapitre";$a12="LivreRareBook";$a13="Galaxidion";

-{;
}

fermer{
plugin(layers,"CloseAll");id(ID_SELECT_URL);id(ID_EDIT_PASTE);
}
Amazon{
$tit="&field-title=";$aut="&field-author=";$isb="&field-asin=";$edi="&field-publisher=";$cle="";
$engi="http://www.amazon.com/exec/obidos/search-handle-url/ref=pd_kk_sr_1/002-8688321-8094407?index=stripbooks&field-subject=&url=field-binding%3D&field-age=&field-language=&field-ignore-date=during+0+3000&field-dateop=during&field-datemod=0&field-dateyear=3000&field-dateyear=&rank=%2Brelevancerank";;
&Getisb;
}
Abebooks{
$tit="&tn=";$aut="&an=";$isb="";$edi="";$cle=&kn=";
$engi="http://www.abebooks.fr/servlet/SearchResults?bx=off&sts=t&ds=30&bi=0&sortby=2";;
&Getisb;
}
BooksOnDemand{
tot="AND TI(";$au="AU(";$isb="&sField=isbn&qText=";$tit="&sField=ti&qText=";$aut="&sField=au&qText=";$cle="&sField=key&qText=";
$enga="http://wwwlib.umi.com/bod/query?submitFlag=&searchMode=advanced&displayMode=citations&query=";;
$engi="http://wwwlib.umi.com/bod/query?prevQuery=&basicSearchType=all&startdate=&enddate=";;
getpref(STRING,"K.query")== "Recherche titre/auteur :" ? pluginmsg(layers,"OpenURLBg",$enga.$au.$word.")".$tot.$mot.")"):&Getisb;
}
Chapitre{
$tit="&titre=";$aut="&auteur=";$edi="&editeur=";$isb="&isbn=";$cle="";
$engi="http://www.chapitre.com/frame_rec.asp?sessionid=4802120403528280119243155&donnee_appel=&source=ANCIEN&date_mode=during&genre=&mot_cle=&tri=QUALITE&date_month=00&date_year=Ann%E9e&date_month2=00&date_year2=Ann%E9e";;
&Getisb;
}
LivreRareBook{
$tit="&ch_tit=";$aut="&ch_aut=";$isb="";$cle="";
$engi="http://www.livre-rare-book.com/cgi-bin/libbcgi?ke=-&ch_mt_min=&ch_mt_max=&dt_min=&ch_mot=&ch_nb_max=1000&ch_cli=&tb_base_0_dp_coche=N&tb_base_0_dp_coche=O";;
&Allkeys;
}
Galaxidion{
$tit="&title=";$aut="&author=";$edi="";$cle="";
$engi="http://www.galaxidion.com/home/catalogues.php?sortOrder=relevance";;
&Allkeys;
}
a1tog{
togglepref(STRING,"MTR1","-",$a1);&Synco;
}
a2tog{
togglepref(STRING,"MTR2","-",$a2);&Synco;
}
a3tog{
togglepref(STRING,"MTR3","-",$a3);&Synco;
}
a11tog{
togglepref(STRING,"MTR11","-",$a11);&Synco;
}
a12tog{
togglepref(STRING,"MTR12","-",$a12);&Synco;
}
a13tog{
togglepref(STRING,"MTR13","-",$a13);&Synco;
}
Pftit{
setpref(STRING,"K.query","Recherche titre/auteur :");&Synco;
}
Pfisb{
setpref(STRING,"K.query","Recherche auteur/editeur :");&Synco;
}
Pfedi{
setpref(STRING,"K.query","Recherche titre/editeur :");&Synco;
}
Synco{
setcheck("macros(Pftit)",getpref(STRING,"K.query")=="Recherche titre/auteur :"?true:false);
setcheck("macros(Pfisb)",getpref(STRING,"K.query")=="Recherche auteur/editeur :"?true:false);
setcheck("macros(Pfedi)",getpref(STRING,"K.query")=="Recherche titre/editeur :"?true:false);
setcheck("macros(a1tog)",getpref(STRING,"MTR1")==$a1?true:false);
setcheck("macros(a2tog)",getpref(STRING,"MTR2")==$a2?true:false);
setcheck("macros(a3tog)",getpref(STRING,"MTR3")==$a3?true:false);
setcheck("macros(a11tog)",getpref(STRING,"MTR11")==$a11?true:false);
setcheck("macros(a12tog)",getpref(STRING,"MTR12")==$a12?true:false);
setcheck("macros(a13tog)",getpref(STRING,"MTR13")==$a13?true:false);
}
SetCH{
getpref(STRING,"K.query")=="Recherche titre/auteur :"? &Pftit:getpref(STRING,"K.query")=="Recherche auteur/editeur :"?&Pfisb:&Pfedi;
getpref(STRING,"MTR1")==$a1?setcheck("macros(a1tog)",getpref(STRING,"MTR1")):"-";
getpref(STRING,"MTR2")==$a2?setcheck("macros(a2tog)",getpref(STRING,"MTR2")):"-";
getpref(STRING,"MTR3")==$a3?setcheck("macros(a3tog)",getpref(STRING,"MTR3")):"-";
getpref(STRING,"MTR11")==$a11?setcheck("macros(a11tog)",getpref(STRING,"MTR11")):"-";
getpref(STRING,"MTR12")==$a12?setcheck("macros(a12tog)",getpref(STRING,"MTR12")):"-";
getpref(STRING,"MTR13")==$a13?setcheck("macros(a13tog)",getpref(STRING,"MTR13")):"-";
}
Mprompt{
setclipboard();$tmp=getclipboard();
$search="Dans : ".$get1." ".$get2." ".$get3." >";
$tip = getpref(STRING,"K.query");
$word = prompt($tip, $search);$search=$tmp;$word==$tmp?&-:&Macget;
}
Macget{
id(ID_SELECT_URL);id(ID_EDIT_COPY);$mot=getclipboard();setclipboard();
macros($get1);macros($get2);macros($get3);
}
MacG{
&Geteng;&Macget;setpref(STRING,"K.query",$uld);
}
Geteng{
$get1=getpref(STRING,"MTR".$n);$get2=getpref(STRING,"MTR".$n+1);$get3=getpref(STRING,"MTR".$n+2);
}
Mang{
$n=1;&Geteng;&Mprompt;
}
Mfra{
$n=11;&Geteng;&Mprompt;
}
Getisb{
getpref(STRING,"K.query")== "ISBN" ? pluginmsg(layers,"OpenURLBg",$engi.$isb.$mot):&Allkeys;
}
Allkeys{
getpref(STRING,"K.query")== "cle" ? pluginmsg(layers,"OpenURLBg",$engi.$cle.$mot):getpref(STRING,"K.query")== "titre" ? pluginmsg(layers,"OpenURLBg",$engi.$tit.$mot):&Getquery;
}
Getquery{
getpref(STRING,"K.query")=="Recherche titre/auteur :"? $quer=$engi.$aut.$word.$tit:getpref(STRING,"K.query") == "Recherche titre/editeur :" ? $quer=$engi.$edi.$word.$tit: &Getedi;
pluginmsg(layers,"OpenURLBg",$quer.$mot);
}
Getedi{
getpref(STRING,"K.query")=="Recherche auteur/editeur :"? $quer=$engi.$edi.$word.$aut:"";
}

Setcle{
$uld=getpref(STRING,"K.query");setpref(STRING,"K.query","cle");
}
Setisb{
$uld=getpref(STRING,"K.query");setpref(STRING,"K.query","ISBN");
}
Settit{
$uld=getpref(STRING,"K.query");setpref(STRING,"K.query","titre");
}
Clang{
$n=1;&Setcle;&MacG;
}
Isbang{
$n=1;&Setisb;&MacG;
}
Titang{
$n=1;&Settit;&MacG;
}
Isbfra{
$n=11;&Setisb;&MacG;
}
Titfra{
$n=11;&Settit;&MacG;
}


dans PREFS :

user_pref("MTR1", "-");
user_pref("MTR2", "-");
user_pref("MTR3", "-");
user_pref("MTR11", "-");
user_pref("MTR12", "-");
user_pref("MTR13", "-");
user_pref("K.query", "Recherche titre/auteur :");

dans MENUS :

Recherche par{
macros(Pftit,Recherche par titre/auteur)
macros(Pfisb,Recherche par auteur/editeur)
macros(Pfedi,Recherche par titre/editeur)
}
Ang{
macros(Isbang,ISBN)
macros(Titang,Titre)
macros(Clang,Mot-clé)
-
macros(a1tog, Amazon)
macros(a2tog, Abebooks)
macros(a3tog, BooksOnDemand)
}
Fra{
macros(Isbfra,ISBN)
macros(Titfra,Titre)
-
macros(a11tog, Chapitre )
macros(a12tog, LivreRareBook)
macros(a13tog, Galaxidion)
}

dans TOOLBARS :

Cherche-livres {
Rech. croisée{
macros(fermer)|Recherche par
Fermer les onglets . Click-droit pour choisir la combinaison.
}

Livres anglais{
macros(Mang)|Ang
English used books. Click-Droit: choix des sites et rech. sur un terme.
}
Livres français{
macros(Mfra)|Fra
French used books. Click-Droit: choix des sites et rech. sur un terme.
}
}

Options: ReplyQuote
Re: Meta engine with combined search and engine selection
Posted by: guenter
Date: February 10, 2005 05:27PM

merci! pour votre travail & greetings from Hannover

p. s. my English is not better either // ROFL

Options: ReplyQuote


K-Meleon forum is powered by Phorum.