@ johnywhy
I have a macro and file which attempt to show a method enable the accelerator key of a site while allowing a return to the default keys of KM. This is only a demo using two sites - todoist and gmail. It could be expanded for other sites by any user. There is an image for the button at
http://img513.imageshack.us/gal.php?g=keystop.png
It needs to be changed to a bmp file for use and put into the Default folder under Skins.
KeyStop.kmm
# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
#
# ---------- KeyStop.kmm
# Dependencies : main.kmm KeyStopH.ini
# Resources : panorama image keystop.bmp in SKINS\DEFAULT
# Preferences : -
# Version : 0.6 7/05/09
# --------------------------------------------------------------------------------
KeyStop_RunCode{
# Lock the button
pluginmsg(toolbars, "EnableButton", "KeyStopBar,macros(KeyStop_RunCode), 0");
# check to see if current hostname($URL) is a section and has a count > zero
$_KeyStop_HostCnt = iniread(hostname($URL), "Count", $_KeyStop_Value, $_KeyStop_Path."\\KeyStopH.ini");
$_KeyStop_HostCnt > 0? &_KeyStop_RunCode2:&_KeyStop_RunStop;
}
_KeyStop_RunCode2{
$_KeyStop_bChecked = pluginmsgex(toolbars, "IsButtonChecked", "KeyStopBar,macros(KeyStop_RunCode)", INT);
# if checked is 1 then default accels are turned off
if ($_KeyStop_bChecked==1) {&_KeyStop_Restore;} else {&_KeyStop_Stop;}
}
_KeyStop_Stop{
$_KeyStop_cntr = 1; $_KeyStop_Host = hostname($URL); $_KeyStop_Off_String = "|";
while ( $_KeyStop_cntr <= $_KeyStop_HostCnt ) {
$_KeyStop_Keys = iniread($_KeyStop_Host, $_KeyStop_cntr, $_KeyStop_Value, $_KeyStop_Path."\\KeyStopH.ini");
## "macros(dummy)" used instead of "" - bug report 1134
setaccel( "\"".$_KeyStop_Keys."\"" ,"macros(dummy)");
$_KeyStop_Off_String = $_KeyStop_Keys . "|" . $_KeyStop_Off_String ;
$_KeyStop_cntr = $_KeyStop_cntr + 1;
}
# set bchecked equal to 1
pluginmsg(toolbars, "CheckButton", "KeyStopBar,macros(KeyStop_RunCode),1");
# Unlock the button
pluginmsg(toolbars, "EnableButton", "KeyStopBar,macros(KeyStop_RunCode), 1");
}
_KeyStop_RunStop{
alert(hostname($URL) . "\n\n has no items in the list." , "WARNING", EXCLAIM);
# Unlock the button
pluginmsg(toolbars, "EnableButton", "KeyStopBar,macros(KeyStop_RunCode), 1");
}
_KeyStop_Restore{
$_KeyStop_I = index($_KeyStop_Off_String,"|") ;
$_KeyStop_cntr = 0;
while ($_KeyStop_I > 1){
$_KeyStop_IK = substr($_KeyStop_Off_String, 0,$_KeyStop_I );
$_KeyStop_Off_String = substr($_KeyStop_Off_String, $_KeyStop_I + 1);
$_KeyStop_I = index($_KeyStop_Off_String,"|") ;
$_KeyStop_IK == "VK_ESCAPE" ? setaccel("VK_ESCAPE", ID_NAV_STOP) :0;
$_KeyStop_IK == "CTRL VK_RETURN" ? setaccel("CTRL VK_RETURN", "macros(domComplete(0))") :0;
$_KeyStop_IK == "CTRL B" ? setaccel("CTRL B", "bookmarks(edit)") :0;
$_KeyStop_IK == "CTRL I" ? setaccel("CTRL I", ID_VIEW_PAGE_INFO) :0;
$_KeyStop_IK == "CTRL U" ? setaccel("CTRL U", ID_VIEW_SOURCE) :0;
$_KeyStop_IK == "CTRL H" ? setaccel("CTRL H", "history(View)") :0;
$_KeyStop_IK == "CTRL N" ? setaccel("CTRL N", ID_NEW_BROWSER) :0;
$_KeyStop_IK == "CTRL S" ? setaccel("CTRL S", ID_FILE_SAVE_AS) :0;
# Add additional defaults here - duplicates not necessary
}
# Set bchecked equal to 0
pluginmsg(toolbars, "CheckButton", "KeyStopBar,macros(KeyStop_RunCode),0");
# Unlock the button
pluginmsg(toolbars, "EnableButton", "KeyStopBar,macros(KeyStop_RunCode), 1");
}
_KeyStop_BuildBar{
$_KS_ToolbarName = "KeyStopBar" ;
$_KS_BSize = "16" ;
$_KS_LastItem = "" ;
$_KS_AddBarTag = $_KS_ToolbarName .",". $_KS_BSize .",". $_KS_BSize .",". $_KS_LastItem ;
pluginmsg(toolbars, "AddToolbar", $_KS_AddBarTag);
$_KS_Command = "macros(KeyStop_RunCode)";
$_KS_ButtonName = "CloseOther" ;
$_KS_MenuName = "" ;
$_KS_tipText = "Disable/Enable local keys";
$_KS_ImageHot = "keystop.bmp[1]" ;
$_KS_ImageCold = "keystop.bmp[0]" ;
$_KS_ImageDead = "keystop.bmp[2]" ;
## Create third parameter for pluginmsg
$_KS_AddButtonTag = $_KS_ToolbarName.",".$_KS_ButtonName.",".$_KS_Command.",".$_KS_MenuName.",".$_KS_tipText.",".$_KS_BSize.",".$_KS_BSize.",".$_KS_ImageHot.",".$_KS_ImageCold.",".$_KS_ImageDead.",".$_KS_LastItem ;
pluginmsg(toolbars, "AddButton", $_KS_AddButtonTag);
}
_KeyStop_GetPath{
$__Data=readfile(getfolder(MacroFolder)."\\KeyStop.kmm");
$_KeyStop_Path=getfolder($__Data==""?UserMacroFolder:MacroFolder);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - -
$OnSetup=$OnSetup."_KeyStop_BuildBar;_KeyStop_GetPath;";
$macroModules=$macroModules."KeyStop;";
KeyStopH.ini
[todoist.com]
Count=7
1=VK_ESCAPE
2=CTRL VK_RETURN
3=CTRL B
4=CTRL I
5=CTRL U
6=CTRL H
7=CTRL N
[mail.google.com]
Count=2
1=VK_ESCAPE
2=CTRL S