Bugs :  K-Meleon Web Browser Forum
You can talk about issues with k-meleon here.  
Repeating new menu item on Main bar (fixed)
Posted by: JamesD
Date: August 21, 2009 08:54PM

I did a program for a request in this thread. http://kmeleonbrowser.org/forum/read.php?1,95706 The macro creates a new menu item on the main menu bar. When the user clicks on the dropdown item the system obtains the external IP address and uses rebuildmenu to make the dropdown item display that address. All this works exactly as intended.

The unintended action is that some links which open in a new window will have two copies of the new menu item on the main menu bar. The code does not run again. I put alerts in the sections to inform me if they do run.

Daily Rotation http://www.dailyrotation.com/index.php is a site where this happens.

If anyone has a idea why this is happening, I would like to hear from you.

There are two files to be put in your usermacro folder.

ActiveIP.kmm
#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
#
# ---------- ActiveIP.kmm
# ---------- K-Meleon Macro Language to show EXTERNAL ip number under MAIN menu ---
# ---------- Clicking on "Refresh" or the IP Number will refresh the IP number       
#
# Dependencies			: main.kmm
# Resources			: "whatismyip.com/automation/n09230945.asp" 
# Preferences			: "k-meleon.ActiveIP.use"
# Version			: 0.3  August 21, 2009 
# --------------------------------------------------------------------------------

_ActiveIP_RunLoad {
macroinfo = "Refresh External IP address";
$ActiveIP_OldURL = $URL ;
setpref(BOOL,"k-meleon.ActiveIP.use", true);
open("whatismyip.com/automation/n09230945.asp");
}

_ActiveIP_RunRead {
id(ID_EDIT_SELECT_ALL);
id(ID_EDIT_COPY);
$ActiveIP_Clip = getclipboard();
macros(_ActiveIP_BuildMenu);
$_ActiveIP_Milliseconds = 5 * ( 60 * 1000 ) ;
exec("wscript.exe \"".$_ActiveIP_Path."\" \"".$ActiveIP_Clip."\" \"".$_ActiveIP_Milliseconds."\"") ;
open($ActiveIP_OldURL) ;
}

_ActiveIP_Auto_stage {
if (getpref(BOOL,"k-meleon.ActiveIP.use") == true ) {
	alert("ActiveIP_Auto_stage", "Running this  DEBUG", INFO);
	macros(_ActiveIP_RunRead);
	delpref("k-meleon.ActiveIP.use");
	}
}

_ActiveIP_StatusBarSet {
if (length($ActiveIP_Clip) != 0) {
statusbar("External IP  ".$ActiveIP_Clip); }
}

_ActiveIP_BuildMenu {
alert("ActiveIP_BuildMenu","Running this  DEBUG", INFO);
$_g="Active IP";
setmenu(Main,popup,$_g,-1);
$__m="TheIP";
setmenu($_g,inline,$__m);
setmenu($__m,macro,$ActiveIP_Clip,_ActiveIP_RunLoad,-1);
rebuildmenu($__m);
}

_ActiveIP_Initial {
$ActiveIP_Clip = "Refresh" ;
}

_ActiveIP_GetPath {
$__Data=readfile(getfolder(MacroFolder)."\\ActiveIP.kmm");
$_ActiveIP_Path=getfolder($__Data==""?UserMacroFolder:MacroFolder)."\\ActiveIP.js";
}

## - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$OnStartup=$OnStartup."_ActiveIP_GetPath;";
$OnLoad=$OnLoad."_ActiveIP_StatusBarSet;";
$OnLoad=$OnLoad."_ActiveIP_Auto_stage;";
$OnInit=$OnInit."_ActiveIP_Initial;";
$OnInit=$OnInit."_ActiveIP_BuildMenu;";
$macroModules=$macroModules."ActiveIP;";
## *** END OF ActiveIP.kmm ***

ActiveIP.js
/* ActiveIP.js by JamesD, version  1.0  2009-08-20

   This script is a helper application for the K-Meleon Macro Module ActiveIP.kmm that
   enables you to set a timer .

   Windows Script Host 1.0 (or better) required!

   WSH is part of Microsoft Internet Explorer 5.0 and newer. Latest version of WSH is
   available at http://msdn.microsoft.com/scripting/
*/

if (WScript.Arguments.count()==2) {
	var ActiveIP_CurrentIP  = WScript.Arguments(0);
	var ActiveIP_Milliseconds  = WScript.Arguments(1);
	WScript.Sleep( ActiveIP_Milliseconds) ;
	var d = new Date();
	WScript.Echo("Timer expired on IP address \n\n " + ActiveIP_CurrentIP + "\n\n " + d) ;
}
else
{
objArgs = WScript.Arguments ;
WScript.Echo(WScript.Arguments.Count());
for (i=0; i<objArgs.length; i++)
	{
    	WScript.Echo(objArgs(i))
	}
}	
// *** END OF ActiveIP.js ***



Edited 1 time(s). Last edit at 08/21/2009 11:33PM by JamesD.

Options: ReplyQuote
Re: Repeating new menu item on Main bar (fixed)
Posted by: JamesD
Date: August 21, 2009 11:35PM

Found the problem. Too much of the menu was in macro with the rebuildmenu statement. Revised kmm file below.

ActiveIP.kmm
#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
#
# ---------- ActiveIP.kmm
# ---------- K-Meleon Macro Language to show EXTERNAL ip number under MAIN menu ---
# ---------- Clicking on "Refresh" or the IP Number will refresh the IP number       
#
# Dependencies			: main.kmm
# Resources			: "whatismyip.com/automation/n09230945.asp" 
# Preferences			: "k-meleon.ActiveIP.use"
# Version			: 0.4  August 21, 2009 
# --------------------------------------------------------------------------------

_ActiveIP_RunLoad {
macroinfo = "Refresh External IP address";
$ActiveIP_OldURL = $URL ;
setpref(BOOL,"k-meleon.ActiveIP.use", true);
open("whatismyip.com/automation/n09230945.asp");
}

_ActiveIP_RunRead {
id(ID_EDIT_SELECT_ALL);
id(ID_EDIT_COPY);
$ActiveIP_Clip = getclipboard();
macros(_ActiveIP_BuildMenuLine);
$_ActiveIP_Milliseconds = 5 * ( 60 * 1000 ) ;
exec("wscript.exe \"".$_ActiveIP_Path."\" \"".$ActiveIP_Clip."\" \"".$_ActiveIP_Milliseconds."\"") ;
open($ActiveIP_OldURL) ;
}

_ActiveIP_Auto_stage {
if (getpref(BOOL,"k-meleon.ActiveIP.use") == true ) {
	macros(_ActiveIP_RunRead);
	delpref("k-meleon.ActiveIP.use");
	}
}

_ActiveIP_StatusBarSet {
if (length($ActiveIP_Clip) != 0) {
statusbar("External IP  ".$ActiveIP_Clip); }
}

_ActiveIP_BuildMenu {
$_g="Active IP";
setmenu(Main,popup,$_g,-1);
$__m="TheIP";
macros(_ActiveIP_BuildMenuLine); 
}
_ActiveIP_BuildMenuLine {
$_g="Active IP";
$__m="TheIP";
setmenu($_g,inline,$__m);
setmenu($__m,macro,$ActiveIP_Clip,_ActiveIP_RunLoad,-1);
rebuildmenu($__m);
}

_ActiveIP_Initial {
$ActiveIP_Clip = "Refresh" ;
}

_ActiveIP_GetPath {
$__Data=readfile(getfolder(MacroFolder)."\\ActiveIP.kmm");
$_ActiveIP_Path=getfolder($__Data==""?UserMacroFolder:MacroFolder)."\\ActiveIP.js";
}

## - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$OnStartup=$OnStartup."_ActiveIP_GetPath;";
$OnLoad=$OnLoad."_ActiveIP_StatusBarSet;";
$OnLoad=$OnLoad."_ActiveIP_Auto_stage;";
$OnInit=$OnInit."_ActiveIP_Initial;";
$OnInit=$OnInit."_ActiveIP_BuildMenu;";
$macroModules=$macroModules."ActiveIP;";
## *** END OF ActiveIP.kmm ***



Edited 1 time(s). Last edit at 08/21/2009 11:37PM by JamesD.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.