K-Meleon

Use this page to experiment with the wiki. (Just don't delete this text; otherwise people won't know the purpose of the page.)




K-Meleon Macro Language 2

(Current version. For outdated functions like layers and macros.cfg read the previous version)



Events

The Macro Extension Plugin provides a variety of events.

Event Is triggered
OnInit When the Default Configuration Files have been parsed.
OnSetup When the User Configuration Files have been parsed.
OnStartup When the first window is opened.
OnOpenWindow When a window is opened.
OnOpenTab When a tab is opened.
OnActivateWindow When a window gets the focus.
OnLoadOnce When the 1st document after filling the $OnLoadOnce variable has finished loading. (1)
OnLoad When a document has finished loading.
OnCloseTab When a tab is closed.
OnCloseWindow When a window is closed.
(OnCloseGroup) When a multi-layered window is closed (obsolete since KM1.5).
(OnWMAppExit) When ID_APP_EXIT is called to terminate the application. (broken?)
OnQuit When the macro plugin (the browser) is being closed.

Not all of these events are supported by all versions of K-Meleon.

(1) Macros in the $OnLoadOnce string will run only 1x, then this string is cleared again. They run prior to those in $OnLoad.

Event Handling

Whenever <event> is triggered, the Macro Extension Plugin will look for a macro named On<event> and execute it if found. The appropriate On<event> macros are provided by default in the main macro module (main.kmm). It provides global $On<event> variables which you can use in your own modules to get code executed whenever <event> is triggered:

           myMacro{
           # your On<event> code
           }
           $On<event>=$On<event>."myMacro;";

On<event> macros are executed in the context of the window that triggered the event.

Event Cascade

          Startup is always followed by Load or OpenWindow.
          OpenWindow is always followed by Load.
          Init, Setup, and Quit are only fired once a session.(1)
          ActivateWindow is usually fired multiple times, each time a browser window is focused.

            Startup Order of Precedence
                 Init
                 Setup
                 Startup(1)
                 OpenWindow(2)
                 OpenTab(2)
                 LoadOnce
                 Load(2)(3)(4)

(1) When the browser is opening a group or folder at startup, the Load event is fired before Startup and Startup is fired multiple times (once for each opened layer).

(2) The use of sessions or groups may fire these events multiple times.

(3) The code on some websites may fire this event multiple times.

(4) LoadOnce runs before Load.

            Shutdown Order of Precedence
                 CloseGroup or WMAppExit(1)
                 CloseWindow(2)
                 Quit

(1) WMAppExit seems currently not to be fired at all. (2) CloseWindow is fired for each closed layer.

K-Meleon

(c) 2000-2010 kmeleonbrowser.org. All rights reserved.
design by splif.