General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Need help with simple macro
Posted by: foliator
Date: January 10, 2016 02:12AM

A while back I created this tiny macro that toggles both JavaScript and cookies in quick succession, similar to a batch command:

ToggleJC{
macros(pref_ToggleJavaScript)
macros(pref_ToggleCookies)
}

It works perfectly, and I assigned Alt Space as a keyboard shortcut, but now I want the page to be automatically reloaded after I've toggled the two items. I've tried the following, but the browser seems to ignore the reload command:

ToggleJC{
macros(pref_ToggleJavaScript)
macros(pref_ToggleCookies)
ID_NAV_FORCE_RELOAD
}

What is the correct approach?

---
Gerry

Options: ReplyQuote
Re: Need help with simple macro
Posted by: JohnHell
Date: January 10, 2016 02:35AM

id(ID_NAV_FORCE_RELOAD);

and don't forget semicolons.

http://kmeleonbrowser.org/wiki/MacroLanguage#special
(scroll a little, depending on your screen height settings)



Edited 2 time(s). Last edit at 01/10/2016 02:36AM by JohnHell.

Options: ReplyQuote
Re: Need help with simple macro
Posted by: foliator
Date: January 10, 2016 04:14AM

Quote
JohnHell
id(ID_NAV_FORCE_RELOAD);

and don't forget semicolons.

http://kmeleonbrowser.org/wiki/MacroLanguage#special
(scroll a little, depending on your screen height settings)

Wow, thanks -- it works perfectly! Now if I try to sign in somewhere and have forgotten to enable JavaScript and cookies -- which happens pretty often -- all I need to do at the error prompt is hit Alt Space and reenter my credentials. I also have buttons on my privacy bar labeled J and C (abbreviated to save space on the toolbar), as well as a special button and icon I created for this macro. The J and C buttons go in or out when I run the macro, of course.

EDIT: I've just removed the big screenshot from this message, as I want to delete it from a temporary directory on my website.

---
Gerry



Edited 2 time(s). Last edit at 01/16/2016 11:29PM by foliator.

Options: ReplyQuote
Re: Need help with simple macro
Posted by: siria
Date: January 10, 2016 08:11AM

Always nice to see people really customizing smiling smiley

But please use page "macrolanguage2" - without number it's the old version for KM1.1 :cool: grinning smiley

"Force" Reload is okay and should work 100%, although for almost all uses the normal one loads a bit faster, taking the unaffected parts from cache (am reloading myself all the time after toggling manually). But keep the "force" if cache and speed is not critical thanks to a modern machine and connection.

ToggleJC{
macros(pref_ToggleJavaScript);
macros(pref_ToggleCookies);
id(ID_NAV_RELOAD);
}

Just some tips for macro help in general, also if other users may come across this:

This and more available commands for macros, like CommandIDs:
http://kmeleonbrowser.org/wiki/EndUserDocs
http://kmeleonbrowser.org/wiki/CommandIds

Also quite handy: Edit > Configuration > Commands List
For quick offline use from the Help menu James has created the macro "LocalDocs", which I love. It also works if the server is down, which seems to happen 'occasionally' here... :cool:

Couldn't live without this, invaluable for finding most macro syntax errors:
Tools > ErrorConsole (with KMM-button switched ON)
chrome://console2/content/console2.xul
(its button in toolbars.cfg is labeled "javascript console", that name has mislead me badly for years)

And extremely helpful also an editor with syntax-highlighting for macros, although wouldn't have helped for THIS case.
http://kmeleonbrowser.org/forum/read.php?9,109335,129077#msg-129077

PS: Since KM75 most commands have become duplicated, Dorian prefers the more direct ones without "ID", but thankfully still lets the traditional "ID" equivalents work too.
Just to add to the confusion, thanks to Mozilla there are now various JS-toggle methods, additional to the global pref also alternatives toggling only the current page (without reload?), but am still not familiar with those myself, being stuck on KM1.6 for the online machine.

Options: ReplyQuote
Re: Need help with simple macro
Posted by: foliator
Date: January 10, 2016 03:49PM

Well, the reason I use force reload is that when I get an error message from a site that I can't log in without cookies, a normal reload after enabling them doesn't help. Even after several reloads in succession, and after clearing all my browsing history, the site doesn't recognize that cookies and JavaScript have been enabled. Forcing reload solves the problem.

I haven't bothered to study the macro language, since ToggleJS is the only macro I needed to create. Those in the download package, and a few posted on this forum, do everything else I need to do.

Yes, customization is KM's most essential feature. In Firefox I've had to install lots of extensions, instead. I refuse to upgrade my FF 15.0.1 to a more recent version, so I've had to work around Mozilla's inaccurate statement that a particular extension is not compatible with my version. That's not always true, because I've sometimes been able to download the .xpi file and install it manually.

UI appearance is another thing: In FF I had to do an enormous amount of research to discover the CSS codes for various UI elements so I could write them into userChrome.css. In KM it took some trial and error to modify the toolbars and menus, but it wasn't as difficult as in FF, where restarting took a long time. Sometimes I thought FF hadn't restarted at all, because it didn't come up on top of another window, while it had actually showed up on the taskbar. What helps in KM is the restart macro, for which I use a keyboard shortcut. KM always restarts very quickly and comes up over any open window.

---
Gerry

Options: ReplyQuote


K-Meleon forum is powered by Phorum.