General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Using more than three proxies in Tools > Proxy?
Posted by: neolem
Date: January 25, 2007 04:12AM

The proxy list for choosing between three proxies under "Tools" is really very convenient. Kudos to whoever had the idea of introducing this original feature! But would it be possible to add even more proxies by editing some file?

Options: ReplyQuote
Re: Using more than three proxies in Tools > Proxy?
Posted by: guenter
Date: January 25, 2007 04:23PM

Yes: Look at:
# ----- Custom Proxies
in macros and menus.cfg.

You can AFAIK extend the list by creating new macro and menü entries shapped after
the example of existing ones.

Options: ReplyQuote
Re: Using more than three proxies in Tools > Proxy?
Posted by: neolem
Date: January 25, 2007 06:38PM

Hmmm... not as easy as that. Added two more proxies (nr.5 and 6) in both of the files you pointed out, also increased what looks to me like two "counters" ($n4) by two, to $n6, but the additional proxies don't show up. They also don't show in the about:config. Maybe it's not possible.

Perhaps the guy who had the idea of that macro can still improve it a bit. For instance, it's not possible to use more than one Socks4 or 5 proxy (you have put one socks4/5 proxy as standard in the socks field and set it in the proxy choice menu list to 0). So when you pick a http proxy, the http field gets filled which overrides the socks field where your one socks proxy is always. But when you pick your socks proxy from the menu list, the http field gets the zero and that one standard socks field is now active. It's still the very best proxy feature any browser ever had so far. :-)

Options: ReplyQuote
Re: Using more than three proxies in Tools > Proxy?
Posted by: guenter
Date: January 25, 2007 07:35PM

pref("kmeleon.plugins.macros.proxy1.name", "Benutzerdefinierter Proxy 1");

habe nachgesehen - sie sind in der I10n.js angelegt, kann man aber in der prefs.js nachschreiben also für 4 und 5 ( während der browser aus ist ). Kann man auch in der about:config machen.

das von dir angesprochene nutze ich nicht. wie das macro ab 1.1 aussieht habe ich mir nicht genau angesehen, aber das erweitert sich u. U. allein - cf. unten. Tschau - muß jetzt los. // sorry for writing German that is faster thx.

# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)

# ---------- Custom Proxies ----------------------------------------------------------------------------------------
#
# Dependencies : main.kmm ($macroPrefBranch)
# Resources : -
# Preferences : kmeleon.plugins.macros.proxy[1-3].name
# kmeleon.plugins.macros.proxy[1-3].http
# kmeleon.plugins.macros.proxy[1-3].http_port
#
# ------------------------------------------------------------------------------------------------------------------

Proxy{
menuchecked=$ARG==0?(getpref(INT,$_Proxy_Active."type")==0)sad smiley(getpref(STRING,$_Proxy_Custom.$ARG.".http")==getpref(STRING,$_Proxy_Active."http"))*(getpref(INT,$_Proxy_Active."type")==1));
$ARG==0?setpref(INT,$_Proxy_Active."type",0):$_n=$ARG;
$ARG==0?statusbar(_("Connecting directly")):&_Proxy;
}
Proxy_Configuration{
$_i=1; while($_i!=4) &_Proxy_ConfigurationLoop;
}

# ----- PRIVATE

$_Proxy_Active="network.proxy.";
$_Proxy_Custom=$macroPrefBranch."proxy";

_Proxy{
$__srvr=getpref(STRING,$_Proxy_Custom.$_n.".http");
$__port=getpref(INT,$_Proxy_Custom.$_n.".http_port");
# When no server url is set, do not change anything!
$__srvr==""?0:setpref(STRING,$_Proxy_Active."http",$__srvr);
$__srvr==""?0:setpref(INT,$_Proxy_Active."http_port",$__port);
$__srvr==""?0:setpref(INT,$_Proxy_Active."type",1);
getpref(INT,$_Proxy_Active."type")==1?statusbar(sub("%url",getpref(STRING,$_Proxy_Active."http"),sub("%port",getpref(INT,$_Proxy_Active."http_port"),_("Connecting over proxy %url:%port")))):&Proxy_0;
}

_Proxy_ConfigurationLoop{
$_name=getpref(STRING,$_Proxy_Custom.$_i.".name");
$_srvr=getpref(STRING,$_Proxy_Custom.$_i.".http");
$_port=getpref(INT,$_Proxy_Custom.$_i.".http_port");
$_tit=sub("%s",$_name==""?$_i:$_name,_("HTTP Proxy Configuration"));
$__msg=sub("%n",$_i,_("Current settings for proxy %n:"))."\n\n".sub("%s",$_name,_("Server name:\t%s"))."\n".sub("%s",$_srvr==""?_("(not set)"):$_srvr,_("Server URL:\t%s"))."\n".sub("%s",$_port==0?_("(not set)"):$_port,_("Server port:\t%s"))."\n\n"._("Do you want to change these settings?");
$__key=confirm($__msg,$_tit,YESNOCANCEL,QUESTION); $__key==YES?&_Proxy_ConfigurationChangesad smiley$__key==NO?$_i=$_i+1:$_i=4);
}
_Proxy_ConfigurationChange{
$_name=prompt(_("Server name:"),$_tit,$_name);
$_name==""?0:setpref(STRING,$_Proxy_Custom.$_i.".name",$_name);
$_name==""?$_srvr="":$_srvr=prompt(_("Server URL:"),$_tit,$_srvr);
$_srvr==""?0:setpref(STRING,$_Proxy_Custom.$_i.".http",$_srvr);
$_srvr==""?$_port="":$_port=prompt(_("Server port:"),$_tit,$_port);
$_port==""?0:setpref(INT,$_Proxy_Custom.$_i.".http_port",$_port);
&_Proxy_BuildMenu;
}

_Proxy_BuildMenu{
# tools menu
$_p="Pro&xy"; $_m="Proxy(";
setmenu(PrivacySecurity,popup,$_p);
setmenu($_p,macro,"&Direct Connection",$_m."0)");
$_j=1; while($_j!=4) &_Proxy_BuildMenuLoop;
setmenu($_p,macro,"Con&figure...",Proxy_Configuration);
setmenu($_p,separator,"Con&figure...");
rebuildmenu($_p);
}
_Proxy_BuildMenuLoop{
setmenu($_p,macro,getpref(STRING,$_Proxy_Custom.$_j.".name"),$_m.$_j.")");
$_j=$_j+1;
}
$OnInit=$OnInit."_Proxy_BuildMenu;";

# ------------------------------------------------------------------------------------------------------------------
$macroModules=$macroModules."Proxy;";



Edited 1 time(s). Last edit at 01/25/2007 07:37PM by guenter.

Options: ReplyQuote
Re: Using more than three proxies in Tools > Proxy?
Posted by: neolem
Date: January 25, 2007 09:06PM

Ha!!! Editing I10n.js did the trick! 5 proxies now in the proxies list! Thanks so much, guenter! Now I can use even a local proxy (like WebWasher, Privoxy, etc.) from time to time when I feel like it. K-Meleon is fully on its way to replace Firefox for good. ;-)

(what I explained about the socks4/5 proxy a bit awkwardly, simply put: when picking a proxy from the drop down menu, it only can write to the first "http" line in the proxy settings, that's why you can't pick different socks proxies, as those can't write themselves in their proper socks field. So you can only enter ONE socks proxy manually yourself.)

Options: ReplyQuote
Re: Using more than three proxies in Tools > Proxy?
Posted by: desga2
Date: January 25, 2007 09:40PM

Note that you must add new code in this sections of code for added new proxys to menus:

In I10n.js file (in path; [...]\K-Meleon\defaults\pref)
/********************************************************************************************************/
// Locale default pref for k-meleon macros
/********************************************************************************************************/

// Custom Proxies
pref("kmeleon.plugins.macros.proxy1.name", "Custom Proxy 1");
pref("kmeleon.plugins.macros.proxy2.name", "Custom Proxy 2");
pref("kmeleon.plugins.macros.proxy3.name", "Custom Proxy 3");

In menus.cfg file in your user KM profile (in path; [...]\K-Meleon\Profiles[user]\!!!!!!!.slt
|or|
C:\Documents and Settings[user]\Program Data\K-Meleon\default\!!!!!!!!.slt)

# ----- Custom Proxies

Pro&xy{
macros(NoProxy,&Direct Connection)
macros(proxy1)
macros(proxy2)
macros(proxy3)
-
macros(ProxyCfg,Con&figure...)
}

Greetings.

K-Meleon in Spanish



Edited 1 time(s). Last edit at 01/25/2007 09:42PM by desga2.

Options: ReplyQuote
Re: Using more than three proxies in Tools > Proxy?
Posted by: kko
Date: January 25, 2007 09:46PM

Quote
neolem
Perhaps the guy who had the idea of that macro can still improve it a bit. ... It's still the very best proxy feature any browser ever had so far.

If I'm right, these macros were originally designed by Hao, the developer of K-Meleon CCF. We found it useful and decided to integrate it in km 1.0. I try to improve it step by step, but it's still pretty limited. I plan to add a GUI to Advanced Preferences to allow all possible settings (similar to Preferences > Proxy). However, I've had no time yet...



Nice to hear that you could make it, neolem.

Since it may be interesting for others too, I try to explain how it's done (for km 1.0x, not 1.1):

Add the boldened lines to your macros.cfg:

# ----- Custom Proxies

$proxy="network.proxy.";
$cprxy=$macroPrefBranch."proxy";

ProxySync{
setcheck("macros(proxy1)",(getpref(STRING,$cprxy."1.http")==getpref(STRING,$proxy."http"))*(getpref(INT,$proxy."type")==1)?true:false);
setcheck("macros(proxy2)",(getpref(STRING,$cprxy."2.http")==getpref(STRING,$proxy."http"))*(getpref(INT,$proxy."type")==1)?true:false);
setcheck("macros(proxy3)",(getpref(STRING,$cprxy."3.http")==getpref(STRING,$proxy."http"))*(getpref(INT,$proxy."type")==1)?true:false);
setcheck("macros(proxy4)",(getpref(STRING,$cprxy."4.http")==getpref(STRING,$proxy."http"))*(getpref(INT,$proxy."type")==1)?true:false);
setcheck("macros(proxy5)",(getpref(STRING,$cprxy."5.http")==getpref(STRING,$proxy."http"))*(getpref(INT,$proxy."type")==1)?true:false);
setcheck("macros(NoProxy)",getpref(INT,$proxy."type")?false:true);
}

proxy1{
$n="1"; menu=getpref(STRING,$cprxy."1.name"); &CPuse;
}
proxy2{
$n="2"; menu=getpref(STRING,$cprxy."2.name"); &CPuse;
}
proxy3{
$n="3"; menu=getpref(STRING,$cprxy."3.name"); &CPuse;
}
proxy4{
$n="4"; menu=getpref(STRING,$cprxy."4.name"); &CPuse;
}
proxy5{
$n="5"; menu=getpref(STRING,$cprxy."5.name"); &CPuse;
}

CPuse{
$srvr=getpref(STRING,$cprxy.$n.".http");
$port=getpref(INT,$cprxy.$n.".http_port");
# When no server url is set, do not change anything!
$srvr==""?0: setpref(STRING,$proxy."http",$srvr);
$srvr==""?0: setpref(INT,$proxy."http_port",$port);
$srvr==""?0: setpref(INT,$proxy."type",1);
getpref(INT,$proxy."type")==1?statusbar(sub("%url",getpref(STRING,$proxy."http"),sub("%port",getpref(INT,$proxy."http_port"),_("Connecting over proxy %url:%port")))):&NoProxy;
&ProxySync;
}
CPset{
$name=prompt(_("Server name:"),$tit,$name);
$name==""?0: setpref(STRING,$cprxy.$n.".name",$name);
$name==""?$srvr="":$srvr=prompt(_("Server URL:"),$tit,$srvr);
$srvr==""?0: setpref(STRING,$cprxy.$n.".http",$srvr);
$srvr==""?$port="":$port=prompt(_("Server port:"),$tit,$port);
$port==""?0: setpref(INT,$cprxy.$n.".http_port",$port);
}

NoProxy {
setpref(INT,$proxy."type",0); statusbar(_("Connecting directly")); &ProxySync;
}

ProxyCfg{
$n=1; while($n!=6) &ProxyCfgLoop;
}
ProxyCfgLoop{
$name=getpref(STRING,$cprxy.$n.".name");
$srvr=getpref(STRING,$cprxy.$n.".http");
$port=getpref(INT,$cprxy.$n.".http_port");
$tit=sub("%s",$name==""?$n:$name,_("HTTP Proxy Configuration"));
$msg=sub("%n",$n,_("Current settings for proxy %n:"))."\n\n".sub("%s",$name,_("Server name:\t%s"))."\n".sub("%s",$srvr==""?_("(not set)"):$srvr,_("Server URL:\t%s"))."\n".sub("%s",$port==0?_("(not set)"):$port,_("Server port:\t%s"))."\n\n"._("Do you want to change these settings?");
$r=confirm($msg,$tit,YESNOCANCEL,QUESTION); $r==YES?&CPset: ($r==NO?$n=$n+1:$n=6);
}

Don't forget the 6 !


Add the boldened lines to your menus.cfg:

# ----- Custom Proxies

Pro&xy{
macros(NoProxy,&Direct Connection)
macros(proxy1)
macros(proxy2)
macros(proxy3)
macros(proxy4)
macros(proxy5)
-
macros(ProxyCfg,Con&figure...)
}


Finally, add these lines to your prefs.js:

user_pref("kmeleon.plugins.macros.proxy1.name", "Custom Proxy 4");
user_pref("kmeleon.plugins.macros.proxy2.name", "Custom Proxy 5");


The files macros.cfg, menus.cfg and prefs.js are all located in your profile directory. You can open this directory from out of km (Edit > Configuration > Profile Directory). Make sure km is closed while editing these files!

Options: ReplyQuote
Re: Using more than three proxies in Tools > Proxy?
Posted by: neolem
Date: January 25, 2007 10:24PM

Wish you every luck with your effort, kko. K-Meleon already has the best proxy handling of all browsers. Imagine changing the proxy in IE!!!! LOL

Opera does have a quick switch for changing just to ONE additional proxy, but does not support any socks proxy. (And in FF the two extensions that are supposed to provide something similar don't work with the skin that I'm using and freeze the browser)

Options: ReplyQuote


K-Meleon forum is powered by Phorum.