General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Pages: 12Next
Current Page: 1 of 2
Needing help from Macro writers (once again)
Posted by: Yogi
Date: March 09, 2015 12:33PM

The request is for the very few proxy users using K-Meleon, me included. smiling smiley

We have already at least 3 macros for proxies (from JamesD, Desga2 and Siria). All work fine.
Though it would be nice to have a button for ProxyToggle pref, integrated into K-Meleon by default. No extra user defined macro.
We already have a PrivBar with buttons for toggle prefs. We could use that PrivBar by default for toggling Proxy as well.
As simple as possible, the less extra code the better. Toggling Proxy on/off and a right-click option for Proxy menu would suffice.

My envisage and since I can't modify the macro myself, the help needed for:

As far as I can see it, main.kmm would need added some lines of code. Correct me if I'm wrong.


# ----- Accessibility/Privacy/Security

$pref_Proxy="????????";

pref_ToggleProxy{
macroinfo=_("????????");
???????????????????????;
???????????????????????;
statusbar(?????????????????????);
}

# ----- PRIVATE

# Menu Integration
_pref_BuildMenu{
# tools menu (Accessibility/Privacy/Security)
$__m=_Privacy_Settings;
setmenu("&Privacy",inline,$__m,?????);

setmenu($__m,macro,"?????????",pref_ToggleProxy);

# Toolbar Integration
_pref_SyncButtons{
$__c="CheckButton"; $__m=",macros(pref_Toggle";
# Privacy Bar (make sure the toolbar name is correct):
$__toolbar="&Privacy Bar";

pluginmsg(toolbars,$__c,$__toolbar.$__m."Proxy),".(????????????????);

# ----- Accessibility/Privacy/Security

$pref_Proxy="??????????????";
----------------------------------------------------------------------------
I don't know what modifications Proxy.kmm would need ???

Finally the user could configure her/his favorite skin to use the needed items on the PrivBar.

%ifplugin macros

Proxy{
macros(pref_ToggleProxy)
Toggle Proxy|Proxy menu
privhot.png[x]
privcold.png[x]
}
_________________________________________________________________

In case it works I don't think a few lines of code added to main.kmm can harm anybody.
Dorian might give the green light to officially add those lines to main.kmm

What it brings for Proxy users: no more extra macro, no extension, no editing after each update.

I would gladly test how it works tongue sticking out smiley

Edit:
My ideea might have also disadvantages I've overlooked, compared to a user defined macro or an extension.
E.g. redundant code. Let me know. It's not my intention to complicate things but to make them more simple. Otherwise it's better to leave everything as it is.



Edited 2 time(s). Last edit at 03/09/2015 01:04PM by Yogi.

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: JamesD
Date: March 09, 2015 03:02PM

@ Yogi

If you can get someone to write this who actually understands proxies, that would be best.

If not, then I will be glad to try to help. If my memory is correct, no longer a certainty, someone had to explain proxy to me when I did the little macro before.

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: Yogi
Date: March 09, 2015 05:44PM

Thanks JamesD!

I'd suggest we wait for a week. I have no idea who among the macro writers has the better understanding for proxies.
All I know is that you, Desga2 and Siria have already written a quite similar macro that works.
The only difference here is that the macro doesn't have to create its own toolbar nor to set its own image. It doesn't even has to auto detect the proxy in use. If it does it's ok but it's not mandatory. It just has to work the way other toggle prefs on the PrivBar (ToggleCookies, Toggle Image,...) work.
A right-click option on the toggle button that brings up the proxy menu would be important nevertheless, so the user can easily swith between different proxies in case there are more than one proxy in the proxy configurations.

In case nobody of the macro writers with better understanding for proxies shows up within a week I will provide all the info about proxies you might need: What a proxy is for, how to set up proxies in proxy configuration, how to test with imaginar/bogus proxies - you don't even need to set up real proxies for testing. Believe me, this part is much easier than one might think. ;-)

Since English isn't my native language, please let me know if some of my wording is confusing.

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: siria
Date: March 09, 2015 06:53PM

Quote
Yogi
The only difference here is that the macro doesn't have to create its own toolbar nor to set its own image.

And the solution to this is that you delete the buildbutton stuff in the macros :cool:
However the SYNC-button stuff must be kept, because that is what tells the button to stay in pressed state or not. And as toolbar name in that sync-block use the name of the privbar.
And then of course in toolbars.cfg the button action must be the same as defined in the macro, or vice-versa.

I wouldn't integrate it into main.kmm, it's easier to keep overview if longer modules are separate, like this one.

If I remember right (and let me join James' disclaimer here, haven't looked it up yet ;-)) the main thing a proxy macro has to do is toggle the main proxy pref between numbers 0-5, and to remember which one the user was using before switching proxies off. How proxies work technically we don't need to know at all, because those dependent prefs are defined in the pref sheet and stored in prefs.js, separately for each configuration. Hm, have a dim memory that one of those 0-5 configs had a little subset to toggle too...
But all I had figured out about this is already written in my macro ProxTog2. No need to reinvent the wheel on my part ;-)

Then again, after a quick look, ProxTog2 was at least partly written as extension of the extension proxy.kmm, to reduce possible conflicts :cool: And then it starts getting a bit complicated again...

Yep, that's it. ProxTog2 was basically meant to some day be merged together with the native proxy.kmm, that's why I remembered it so simple! The (horribly) complicated stuff was already handled by proxy.kmm, while all the additional macro did was merely switch on-off the main pref (and remember the last active type) tongue sticking out smiley



Edited 2 time(s). Last edit at 03/09/2015 07:37PM by siria.

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: Dorian
Date: March 09, 2015 08:24PM

This request made me realise a shortcoming. checkbutton is dependent of the toolbar name, so you can't choose the toolbar freely.

In proxy.kmm add

Proxy_Toggle{
menuchecked=(getpref(INT,$_Proxy_Type)!=0);
getpref(INT,$_Proxy_Type) == 0 ? &_Proxy_Custom : &Proxy_None;
checkbutton("&Privacy Bar", "macros(Proxy_Toggle)", getpref(INT,$_Proxy_Type) == 0 ? true : false);
}

and modify

_Proxy_BuildMenu{
# tools menu
$_p="Pro&xy";
setmenu(PrivacySecurity,popup,$_p);
setmenu($_p,macro,"&Direct Connection",Proxy_None);
setmenu($_p,macro,"&Auto Detect",Proxy_Auto);
setmenu($_p,inline,_Custom_Proxies);
setmenu($_p,macro,"Con&figure...","kmPrefs(proxy)");
setmenu($_p,separator,"Con&figure...");
$List=getpref(STRING,$macroPrefBranch."proxy.configs"); $ExecMacros="_Proxy_BuildMenuItem"; &ExecMacros_List;
$_proxy=getpref(STRING,$_Proxy_Current);
}


In toolbars.cfg, &Privacy Bar

!Proxy{
macros(Proxy_Toggle)|Pro&xy
Disable proxy.
check.png[0,32,32]
}


This won't work though, because checkbutton is bugged ! You have to replace it with the old pluginmsg

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: JamesD
Date: March 09, 2015 08:53PM

OK, I finally found a copy of my macro. As Siria said all it did was create a button, which I don't have, and keep track of the state of "network.proxy.type". If I understand the current request it is to do that using the privacy bar and the standard on/off image.

My concern is where on the privacy bar to put this. I am trying very hard to do away the privacy bar on my system. It is far too long to fit my displays except for one which has a wide screen monitor.

Another point is that the pref is not bool, but is integer. That may not be a problem. We just have to get the "menuchecked=" return to be bool.

Can someone point me to the third macro? I think it was by Desga. I don't have that one.

Can a macro create a button on an existing bar? If not, then Dorian would have to be involved, wouldn't he?

The stuff that I have done was with my own skins and edits to toolbars.cfg and skin.cfg.

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: siria
Date: March 09, 2015 09:04PM

offtopic

Quote
JamesD
I am trying very hard to do away the privacy bar on my system. It is far too long to fit my displays except for one which has a wide screen monitor.

Very sorry to hear sad smiley The default Aura skin in KM74 still uses huge 64x13 buttons, like old Phoenity. Klassic is smaller, 54x10, but has a microscopic font. But years ago I made myself one with smaller buttons, 46x11, and same text size as Phoenity but with long names abbreviated a bit. Perhaps it would help? Had posted it some months ago in graphics if remember correctly.

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: siria
Date: March 09, 2015 09:31PM

Quote
Dorian
!Proxy{
macros(Proxy_Toggle)|Pro&xy
Disable proxy.
check.png[0,32,32]
}

After having just read in changelog that "!" will create a text button, and knowing that "check.png" is just the small red-green dot, this looks quite exciting now! Reads like an icon PLUS text button?! I wouldn't even have started to dream of such a possibility... :O grinning smiley

And more new macro commands in changelog, sounds great!! smiling smiley smiling smiley

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: siria
Date: March 09, 2015 09:58PM

Am a little bit behind, as usual ;-) Noticed now that those icon-text buttons are already built into beta3! And slowly, slowly starting to figure it out a bit better....
Have now shortened in toolbars.cfg the button names (text before {) for the privbar, and deleted the "clear" words since they already show a trash bin. And voila - now the privbar is only about half as long!

PS: in skin.cfg, are the menu names right for Fav+Hotlist..?
"@&Bookmarks", "&F&avorites", "H&otlist"

Please, consider adding already existing context-menus on the priv-buttons... :cool: (nag, nag ;-)

And another lightbulb... For the longest privbutton words we can simply omit the additional icon, or use a very narrow one, then it leaves more space for the text...



Edited 3 time(s). Last edit at 03/09/2015 10:22PM by siria.

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: Yogi
Date: March 09, 2015 10:54PM

First of all many thanks for the inputs!!!

I've tried Dorian's solution. Testing with 2 different proxies. It does exactly what I meant.

There is only a single problem caused by my ignorance.
Toggling on/off works, switching between proxies works and the note in the status bar gives the correct status.
Everything works fine except the image on the PrivBar doesn't change. It does only as long as I hover with the mouse over it. Neither does it stay pressed.
I'm testing for now with my favorite skin the Klassic one.

The changes I've done in toolbars.cfg of the Klassic skin:
Instead of
    !Proxy{
    macros(Proxy_Toggle)|Pro&xy
    Disable proxy.
    check.png[0,32,32]
    }

    Proxy{
    macros(Proxy_Toggle)|Pro&xy
    Toggle proxy.
    privhot.png[1]
    privcold.png[1]
    }

I've left out the exclamation mark since I have 16x16 PNG images on my PrivBars.
Can someone please give me a hint about what I'm doing wrong?

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: siria
Date: March 09, 2015 11:28PM

Nothing wrong in your cfg, Yogi. The command "Stay pressed!" can only be fired by macro.

Dorian mentioned this new command wouldn't work yet:
checkbutton("&Privacy Bar", "macros(Proxy_Toggle)", getpref(INT,$_Proxy_Type) == 0 ? true : false);
and to use the old one instead:
pluginmsg(toolbars,"CheckButton", "&Privacy Bar,macros(Proxy_Toggle),".getpref(INT,$_Proxy_Type)==0 ? true : false);
(not 100% sure of syntax, could also be ?1:0, just try)

Am just riddling if that can also toggle the automatic versions 4+5, have doubts...

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: Yogi
Date: March 10, 2015 12:31AM

No joy. I've tried all the ways.

pluginmsg("&Privacy Bar", "macros(Proxy_Toggle)", getpref(INT,$_Proxy_Type) == 0 ? true : false);

pluginmsg(toolbars,"CheckButton", "&Privacy Bar,macros(Proxy_Toggle),".getpref(INT,$_Proxy_Type)==0 ? true : false);

pluginmsg(toolbars,"CheckButton", "&Privacy Bar,macros(Proxy_Toggle),".getpref(INT,$_Proxy_Type)==0 ? 0 : 1);

pluginmsg(toolbars,"CheckButton", "&Privacy Bar,macros(Proxy_Toggle),".getpref(INT,$_Proxy_Type)==0 ? 1 : 0);


Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: siria
Date: March 10, 2015 12:42AM

this?
getpref(INT,$_Proxy_Type)==0 ? $_z="1" : $_z="0";
pluginmsg(toolbars,"CheckButton", "&Privacy Bar,macros(Proxy_Toggle),".$_z);

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: Yogi
Date: March 10, 2015 12:48AM

Proxy_Toggle{
menuchecked=(getpref(INT,$_Proxy_Type)!=0);
getpref(INT,$_Proxy_Type)==0 ? $_z="1" : $_z="0";
pluginmsg(toolbars,"CheckButton", "&Privacy Bar,macros(Proxy_Toggle),".$_z);
}

This way it doesn't work at all.

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: siria
Date: March 10, 2015 12:59AM

LOL! Of course, because you deleted the command! grinning smiley
Little misunderstanding due to same beginning, but I meant to replace the checkbutton line with 2 lines. Wasn't aware they start out the same ;-)

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: Yogi
Date: March 10, 2015 01:39AM

It works!!!!!!

I can toggle on/off from the button, image is changing, button stays pressed. smiling smiley
Only minor cosmetical shortcoming, it can't catch up changes I make from the menu.

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: siria
Date: March 10, 2015 02:20AM

Nice to read grinning smiley
Yeah, the checkbutton-command must be added after every action that switches the proxy. That means inserting it 3x more in the kmm. After the statusbars or directly before is a good place, because that's usually at the end of a macro too.
Usually it's first wrapped into a little submacro xxx_syncButton to handle it easier.

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: Yogi
Date: March 10, 2015 11:29AM

Now it's perfect! It also catches up the changes made in menu.
I've added the checkbutton-commands as advised.
For whatever reason those commands have to be placed at the end, after the statusbar. If placed directly before the statusbar it doesn't work.
It works now exactly how I thought to be most convenient.

Once again, many thanks to all of you!

I've tested now with the AuraAlpha skin as well even though I never use that skin. Works the same. Great!

I'm a notorious ignorant. Didn't even know that the default skin has a toolbars.cfg, pretty much like the old one was but even more handy.
However trying to access it from the menu fails. I had to search for it.

K-Meleon is great and gets even better. :cool:



Edited 1 time(s). Last edit at 03/10/2015 11:29AM by Yogi.

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: soccerfan
Date: March 10, 2015 11:42AM

Quote
Yogi
Now it's perfect! ....
It works now exactly how I thought to be most convenient.....

Could you please attach the files that you changed
(or list the final code that works). Many thanks.

soccerfan

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: Yogi
Date: March 10, 2015 12:17PM

Back up your Proxy.kmm and replace it with this one:
# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)

# ---------- Custom Proxies ----------------------------------------------------------------------------------------
#
# Dependencies	: main.kmm ($macroPrefBranch, kmPrefs, ExecMacros)
# Resources	: -
# Preferences	: kmeleon.plugins.macros.proxy.configs
#		  kmeleon.plugins.macros.proxy.current
#		  kmeleon.plugins.macros.proxy0.http.proxy.keep-alive
#		  kmeleon.plugins.macros.proxy0.http.proxy.pipelining
#		  kmeleon.plugins.macros.proxy0.http.proxy.version
#		  kmeleon.plugins.macros.proxy<n>... (set by kmPrefs)
#
# ------------------------------------------------------------------------------------------------------------------

Proxy_None{
macroinfo=_("Connect directly to the Internet");
menuchecked=(getpref(INT,$_Proxy_Type)==0);
setpref(INT,$_Proxy_Type,0); statusbar(_("Connecting directly"));
getpref(INT,$_Proxy_Type)==0 ? $_z="1" : $_z="0";
pluginmsg(toolbars,"CheckButton", "&Privacy Bar,macros(Proxy_Toggle),".$_z);
}
Proxy_Auto{
macroinfo=_("Connect to the Internet over any detected proxy");
menuchecked=(getpref(INT,$_Proxy_Type)==4);
setpref(BOOL,"network.http.proxy.keep-alive",getpref(BOOL,$macroPrefBranch."proxy0.http.proxy.keep-alive"));
setpref(BOOL,"network.http.proxy.pipelining",getpref(BOOL,$macroPrefBranch."proxy0.http.proxy.pipelining"));
setpref(STRING,"network.http.proxy.version",getpref(STRING,$macroPrefBranch."proxy0.http.proxy.version"));
setpref(INT,$_Proxy_Type,4); statusbar(_("Connecting over any detected proxy"));
getpref(INT,$_Proxy_Type)==0 ? $_z="1" : $_z="0";
pluginmsg(toolbars,"CheckButton", "&Privacy Bar,macros(Proxy_Toggle),".$_z);
}
Proxy_Custom{
macroinfo=_("Connect to the Internet over the specified proxy");
menuchecked=(getpref(STRING,$_Proxy_Current)==$ARG)*(getpref(INT,$_Proxy_Type)!=0)*(getpref(INT,$_Proxy_Type)!=4);
menugrayed=!getpref(STRING,$macroPrefBranch.$ARG.".name");
$_proxy=$ARG; getpref(STRING,$macroPrefBranch.$ARG.".name")==""?0:&_Proxy_Custom;
}

# ----- PRIVATE

$_Proxy_Type="network.proxy.type";
$_Proxy_Current=$macroPrefBranch."proxy.current";

$_Proxy_PrefBool=".http.proxy.keep-alive;.http.proxy.pipelining;.proxy.socks_remote_dns;";
$_Proxy_PrefInt=".proxy.type;.proxy.socks_version;.proxy.http_port;.proxy.ssl_port;.proxy.ftp_port;.proxy.gopher_port;.proxy.socks_port;";
$_Proxy_PrefStr=".http.proxy.version;.proxy.autoconfig_url;.proxy.http;.proxy.ssl;.proxy.ftp;.proxy.gopher;.proxy.socks;.proxy.no_proxies_on;";

_Proxy_Custom{
setpref(STRING,$_Proxy_Current,$_proxy); $ExecMacros="_Proxy_SetPref";
$_type=BOOL;   $List=$_Proxy_PrefBool; &ExecMacros_List;
$_type=INT;    $List=$_Proxy_PrefInt;  &ExecMacros_List;
$_type=STRING; $List=$_Proxy_PrefStr;  &ExecMacros_List;
statusbar(sub("%s",getpref(STRING,$macroPrefBranch.$_proxy.".name"),_("Connecting over proxy '%s'")));
getpref(INT,$_Proxy_Type)==0 ? $_z="1" : $_z="0";
pluginmsg(toolbars,"CheckButton", "&Privacy Bar,macros(Proxy_Toggle),".$_z);
}
_Proxy_SetPref{
setpref($_type,"network".$ListItem,getpref($_type,$macroPrefBranch.$_proxy.$ListItem));
}

Proxy_Toggle{
menuchecked=(getpref(INT,$_Proxy_Type)!=0);
getpref(INT,$_Proxy_Type) == 0 ? &_Proxy_Custom : &Proxy_None;
getpref(INT,$_Proxy_Type)==0 ? $_z="1" : $_z="0";
pluginmsg(toolbars,"CheckButton", "&Privacy Bar,macros(Proxy_Toggle),".$_z);
}

_Proxy_BuildMenu{
# tools menu
$_p="Pro&xy";
setmenu(PrivacySecurity,popup,$_p);
setmenu($_p,macro,"&Direct Connection",Proxy_None);
setmenu($_p,macro,"&Auto Detect",Proxy_Auto);
setmenu($_p,inline,_Custom_Proxies);
setmenu($_p,macro,"Con&figure...","kmPrefs(proxy)");
setmenu($_p,separator,"Con&figure...");
$List=getpref(STRING,$macroPrefBranch."proxy.configs"); $ExecMacros="_Proxy_BuildMenuItem"; &ExecMacros_List;
$_proxy=getpref(STRING,$_Proxy_Current);
}

_Proxy_BuildMenuItem{
setmenu(_Custom_Proxies,macro,getpref(STRING,$macroPrefBranch.$ListItem.".name"),"Proxy_Custom(".$ListItem.")");
}
$OnInit=$OnInit."_Proxy_BuildMenu;";

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

Add this to toolbars.cfg of the default (AuraAlpha) skin:

    !Proxy{
    macros(Proxy_Toggle)|Pro&xy
    Toggle proxy|Menu.
    check.png[0,32,32]
    }

In case you are using another skin you'll have to add to the PrivBars the images for the proxy button and you'll have to make minor changes to the above code.
Let me know if you need some help.



Edited 2 time(s). Last edit at 03/10/2015 12:26PM by Yogi.

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: soccerfan
Date: March 10, 2015 12:59PM

Quote
Yogi
Add this to toolbars.cfg of the default (AuraAlpha) skin:

    !Proxy{
    macros(Proxy_Toggle)|Pro&xy
    Toggle proxy|Menu.
    check.png[0,32,32]
    }
Let me know if you need some help.

Thanks Yogi, but there is no toolbars.cfg
in the folder named 'default' under skins
(in kmeleon 75). Am I missing something?
_________________________________
EDIT: Is it the toolbars.cfg in this folder /browser/defaults/settings?

soccerfan



Edited 1 time(s). Last edit at 03/10/2015 01:11PM by soccerfan.

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: rodocop
Date: March 10, 2015 01:43PM

default toolbar config is placed here:
\browser\defaults\settings\toolbars.cfg

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: soccerfan
Date: March 10, 2015 02:42PM

Thanks Yogi and rodocop. Found toolbar.cfg
and got the proxy button working in privbar tongue sticking out smiley

soccerfan

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: Yogi
Date: March 12, 2015 12:11PM

Unfortunately my statement that it works was premature.
The problem is that the Proxy setting doesn't get checked at browser start up.

At browser start up the Proxy button is always depressed whatever the real setting for the Proxy is.
I didn't notice till yesterday since the depressed status happened to coincide with the actual Proxy setting.

It's not related to Km-75b3u3. The same applies to Km-74 as well.

Maybe I'll try to adapt desga2's Proxy2.kmm extension which I've been using till now.
However with my macro skills nearly ∅, I doubt that something useful will come out grinning smiley



Edited 5 time(s). Last edit at 03/12/2015 01:01PM by Yogi.

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: siria
Date: March 12, 2015 05:58PM

Remember you have to run checkbutton if the button state shall be checked ;-)
To do this at startup, add this new macro at the end:
$OnStartup=$OnStartup."_Proxy_SyncButton;";

After creating it like this:

_Proxy_SyncButton{
getpref(INT,$_Proxy_Type)==0 ? $_z="1" : $_z="0";
pluginmsg(toolbars,"CheckButton", "&Privacy Bar,macros(Proxy_Toggle),".$_z);
}

And in all the 4-5 places where you have the full two lines now, replace them with this short macro too:
"&_Proxy_SyncButton;"

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: Yogi
Date: March 12, 2015 08:13PM

EVERYTHING works fine now. :cool: THANKS!!!

Nevertheless a question.
Is there a recommended place to put this
_Proxy_SyncButton{
getpref(INT,$_Proxy_Type)==0 ? $_z="1" : $_z="0";
pluginmsg(toolbars,"CheckButton", "&Privacy Bar,macros(Proxy_Toggle),".$_z);
}
or it doesn't really matter. It seems that it doesn't really matter.

I've placed it between "_Proxy_SetPref{..." and "Proxy_Toggle{...".

However, I'll post the macro here for Soccerfan.

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: siria
Date: March 12, 2015 08:40PM

No doesn't matter much, the position is independant.
The best way to check if it's really okay is to 1) just test if it works and 2) to check if the errorconsole complains about anything.

But perhaps add a comment near the header somewhere how to *create* the button, that is must be done manually via toolbars.cfg. Because usually macros that toggle buttons also create them themselves, so this might get confusing to later users not aware of this thread and may use other skins ;-)
(and I'm still not convinced that toggling back would work also for types 4+5 :coolsmiling smiley



Edited 1 time(s). Last edit at 03/12/2015 08:44PM by siria.

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: soccerfan
Date: March 12, 2015 09:10PM

Quote
Yogi
EVERYTHING works fine now. :cool: THANKS!!!
.....
However, I'll post the macro here for Soccerfan.

Thanks. Looking forward to it.
The reason I did not have any problems is because
I run kmeleon in Sandboxie.

soccerfan

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: Yogi
Date: March 12, 2015 11:13PM

Quote
siria
But perhaps add a comment near the header somewhere how to *create* the button, that is must be done manually via toolbars.cfg. Because usually macros that toggle buttons also create them themselves, so this might get confusing to later users not aware of this thread and may use other skins ;-)
(and I'm still not convinced that toggling back would work also for types 4+5 :coolsmiling smiley

A wish of mine was that some day toggling proxies will become a default item of the PrivBar.
However upon reflection, there are some problems with that.
It seems that there is only a very small number of users who are using a proxy. Two regulars of this forum is pretty little.
Wonder how many users would use this item anyway, even if shipped by default in the PrivBar. Since it isn't a widely used setting, it should be commented out by default in toolbars.cfg. Many users don't even use the PrivBar while average users who never visit this forum might not even notice about its existence.
Probably there won't be many later users using this feature.
Nonetheless it would make sense perhaps to add this macro to the MacroLibrary.
You would be the right person for it. After all without your help it wouldn't become workable anytime soon. smiling smiley

As for testing if toggling back would work also for types 4+5, I can't. I've never used the WPAD protocol.

Options: ReplyQuote
Re: Needing help from Macro writers (once again)
Posted by: Yogi
Date: March 12, 2015 11:18PM

@soccerfan

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

# ---------- Custom Proxies ----------------------------------------------------------------------------------------
#
# Dependencies	: main.kmm ($macroPrefBranch, kmPrefs, ExecMacros)
# Resources	: -
# Preferences	: kmeleon.plugins.macros.proxy.configs
#		  kmeleon.plugins.macros.proxy.current
#		  kmeleon.plugins.macros.proxy0.http.proxy.keep-alive
#		  kmeleon.plugins.macros.proxy0.http.proxy.pipelining
#		  kmeleon.plugins.macros.proxy0.http.proxy.version
#		  kmeleon.plugins.macros.proxy<n>... (set by kmPrefs)
#
# ------------------------------------------------------------------------------------------------------------------

Proxy_None{
macroinfo=_("Connect directly to the Internet");
menuchecked=(getpref(INT,$_Proxy_Type)==0);
setpref(INT,$_Proxy_Type,0); statusbar(_("Connecting directly"));
&_Proxy_SyncButton;
}
Proxy_Auto{
macroinfo=_("Connect to the Internet over any detected proxy");
menuchecked=(getpref(INT,$_Proxy_Type)==4);
setpref(BOOL,"network.http.proxy.keep-alive",getpref(BOOL,$macroPrefBranch."proxy0.http.proxy.keep-alive"));
setpref(BOOL,"network.http.proxy.pipelining",getpref(BOOL,$macroPrefBranch."proxy0.http.proxy.pipelining"));
setpref(STRING,"network.http.proxy.version",getpref(STRING,$macroPrefBranch."proxy0.http.proxy.version"));
setpref(INT,$_Proxy_Type,4); statusbar(_("Connecting over any detected proxy"));
&_Proxy_SyncButton;
}
Proxy_Custom{
macroinfo=_("Connect to the Internet over the specified proxy");
menuchecked=(getpref(STRING,$_Proxy_Current)==$ARG)*(getpref(INT,$_Proxy_Type)!=0)*(getpref(INT,$_Proxy_Type)!=4);
menugrayed=!getpref(STRING,$macroPrefBranch.$ARG.".name");
$_proxy=$ARG; getpref(STRING,$macroPrefBranch.$ARG.".name")==""?0:&_Proxy_Custom;
}

# ----- PRIVATE

$_Proxy_Type="network.proxy.type";
$_Proxy_Current=$macroPrefBranch."proxy.current";

$_Proxy_PrefBool=".http.proxy.keep-alive;.http.proxy.pipelining;.proxy.socks_remote_dns;";
$_Proxy_PrefInt=".proxy.type;.proxy.socks_version;.proxy.http_port;.proxy.ssl_port;.proxy.ftp_port;.proxy.gopher_port;.proxy.socks_port;";
$_Proxy_PrefStr=".http.proxy.version;.proxy.autoconfig_url;.proxy.http;.proxy.ssl;.proxy.ftp;.proxy.gopher;.proxy.socks;.proxy.no_proxies_on;";

_Proxy_Custom{
setpref(STRING,$_Proxy_Current,$_proxy); $ExecMacros="_Proxy_SetPref";
$_type=BOOL;   $List=$_Proxy_PrefBool; &ExecMacros_List;
$_type=INT;    $List=$_Proxy_PrefInt;  &ExecMacros_List;
$_type=STRING; $List=$_Proxy_PrefStr;  &ExecMacros_List;
statusbar(sub("%s",getpref(STRING,$macroPrefBranch.$_proxy.".name"),_("Connecting over proxy '%s'")));
&_Proxy_SyncButton;
}

_Proxy_SetPref{
setpref($_type,"network".$ListItem,getpref($_type,$macroPrefBranch.$_proxy.$ListItem));
}

_Proxy_SyncButton{
getpref(INT,$_Proxy_Type)==0 ? $_z="1" : $_z="0";
pluginmsg(toolbars,"CheckButton", "&Privacy Bar,macros(Proxy_Toggle),".$_z);
}

Proxy_Toggle{
menuchecked=(getpref(INT,$_Proxy_Type)!=0);
getpref(INT,$_Proxy_Type) == 0 ? &_Proxy_Custom : &Proxy_None;
&_Proxy_SyncButton;
}

_Proxy_BuildMenu{
# tools menu
$_p="Pro&xy";
setmenu(PrivacySecurity,popup,$_p);
setmenu($_p,macro,"&Direct Connection",Proxy_None);
setmenu($_p,macro,"&Auto Detect",Proxy_Auto);
setmenu($_p,inline,_Custom_Proxies);
setmenu($_p,macro,"Con&figure...","kmPrefs(proxy)");
setmenu($_p,separator,"Con&figure...");
$List=getpref(STRING,$macroPrefBranch."proxy.configs"); $ExecMacros="_Proxy_BuildMenuItem"; &ExecMacros_List;
$_proxy=getpref(STRING,$_Proxy_Current);
}

_Proxy_BuildMenuItem{
setmenu(_Custom_Proxies,macro,getpref(STRING,$macroPrefBranch.$ListItem.".name"),"Proxy_Custom(".$ListItem.")");
}
$OnInit=$OnInit."_Proxy_BuildMenu;";
$OnStartup=$OnStartup."_Proxy_SyncButton;";

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


Options: ReplyQuote
Pages: 12Next
Current Page: 1 of 2


K-Meleon forum is powered by Phorum.