Improvement requests :  K-Meleon Web Browser Forum
Use this forum to talk about a feature you're missing. 
website's ip
Posted by: disrupted
Date: September 22, 2008 06:12PM

option to display website's ip in statusbar or urlbar.

something similar to this firefox extension:
https://addons.mozilla.org/en-US/firefox/addon/590

Options: ReplyQuote
Re: website's ip
Posted by: JamesD
Date: September 28, 2008 08:37PM

As I do not know how to convert Firefox stuff for KM, I tried to get the info using the macro system. I have two versions of a macro called PingBack.

One looks up the IP address for every page load and that can be displayed in the title from a memu item under Tools menu.

The other version only looks up the IP address on demand from the popup menu under the Tools menu. A second item on the popup will display the IP address in the title.

The reason the user has to ask for the display to title is that I do not know of a way to have the macro execution stop and wait for ping.exe to complete and output to file.

The requirements are that a user will copy one of the PingBack.kmm files and the PingBack.bat file and put them in the UserMacro area of the profile.

PingBack.kmm -- Automatic lookup version
#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
#
# ---------- PingBack.kmm
# ---------- K-Meleon Macro Language to show the ip number of the page host ---------------
#
# Dependencies			: main.kmm
# Resources				: PingBack.bat, PingBack.dat
# Preferences			: -
# Version				: 0.7   2008-09-28
# --------------------------------------------------------------------------------

_PingBack_RunPing{
$_PingBack_HostNameOfURL = hostname($URL) ;
$_PingBack_TempOutPath = getfolder(UserMacroFolder)."\\PingBack.dat";
exec("\"".$_PingBack_PathBat."\"" . " " . "\"".$_PingBack_HostNameOfURL."\"" . " " . "\"". $_PingBack_TempOutPath ."\"" ) ;
#setclipboard("\"".$_PingBack_PathBat."\"" . " " . "\"".$_PingBack_HostNameOfURL."\"" . " " . "\"". $_PingBack_TempOutPath ."\"");
}

_PingBack_RunCode{
macroinfo="Display IP number for current host";
$_PingBack_IP_File = readfile($_PingBack_TempOutPath );
$_PingBackLB = index($_PingBack_IP_File,"[");
$_PingBackRB = index($_PingBack_IP_File,"]");
$_PingBackLn = $_PingBackRB - $_PingBackLB ;
$_PingBack_IP =  substr( $_PingBack_IP_File, $_PingBackLB, $_PingBackLn +1); 
$TITLE = $_PingBack_IP . "  " . $TITLE ;
}

_PingBack_BuildMenu{
# add another option to Tools menu 
setmenu("&Tools",macro,"PingBack",_PingBack_RunCode,Misc);
}

_PingBack_GetPathBat{
$__DataB=readfile(getfolder(MacroFolder)."\\PingBack.bat");
$_PingBack_PathBat=getfolder($__DataB==""?UserMacroFolder:MacroFolder)."\\PingBack.bat";
}

$OnStartup=$OnStartup."_PingBack_GetPathBat;";
$OnInit=$OnInit."_PingBack_BuildMenu;";
$OnLoad=$OnLoad."_PingBack_RunPing;";
$macroModules=$macroModules."PingBack;";

PingBack.kmm -- On demand lookup version
#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
#
# ---------- PingBack.kmm
# ---------- K-Meleon Macro Language to show the ip number of the page host ---------------
#
# Dependencies			: main.kmm
# Resources				: PingBack.bat, PingBack.dat
# Preferences			: -
# Version				: 0.7   2008-09-28
# --------------------------------------------------------------------------------

_PingBack_RunPing{
macroinfo="Obtain IP number for current host";
$_PingBack_HostNameOfURL = hostname($URL) ;
$_PingBack_TempOutPath = getfolder(UserMacroFolder)."\\PingBack.dat";
exec("\"".$_PingBack_PathBat."\"" . " " . "\"".$_PingBack_HostNameOfURL."\"" . " " . "\"". $_PingBack_TempOutPath ."\"" ) ;
#setclipboard("\"".$_PingBack_PathBat."\"" . " " . "\"".$_PingBack_HostNameOfURL."\"" . " " . "\"". $_PingBack_TempOutPath ."\"");
}

_PingBack_RunCode{
macroinfo="Display IP number for current host";
$_PingBack_IP_File = readfile($_PingBack_TempOutPath );
$_PingBackLB = index($_PingBack_IP_File,"[");
$_PingBackRB = index($_PingBack_IP_File,"]");
$_PingBackLn = $_PingBackRB - $_PingBackLB ;
$_PingBack_IP =  substr( $_PingBack_IP_File, $_PingBackLB, $_PingBackLn +1); 
$TITLE = $_PingBack_IP . "  " . $TITLE ;
}

_PingBack_BuildMenu{
# add another option to Misc section of Tools menu
$_PingBack_Popm = "PingBack" ;
setmenu("&Tools",popup,$_PingBack_Popm,Misc);
setmenu($_PingBack_Popm,macro,"Obtain IP",_PingBack_RunPing,0);
setmenu($_PingBack_Popm,macro,"Display IP",_PingBack_RunCode,1);
}

_PingBack_GetPathBat{
$__DataB=readfile(getfolder(MacroFolder)."\\PingBack.bat");
$_PingBack_PathBat=getfolder($__DataB==""?UserMacroFolder:MacroFolder)."\\PingBack.bat";
}

$OnStartup=$OnStartup."_PingBack_GetPathBat;";
$OnInit=$OnInit."_PingBack_BuildMenu;";
$macroModules=$macroModules."PingBack;";

PingBack.bat -- Required batch file
ping.exe -n 1 %1 > %2


Options: ReplyQuote
Re: website's ip
Posted by: disrupted(unlogged)
Date: September 29, 2008 06:17AM

thank you very much james, i like the idea a lot but for some reason it's not working with me.. ping.exe pops very quickly when i select obtain ip, i can onlyget a glimpse..i can see it gets the ip but there's also a message about specified path not found or something.. it only comes up for less than a second.. the verbose command didn't work, think doesn't support it. when i select display ip, the title bar text(page document name etc) shifts like 4 pixels to the right, like it's trying to write it in but it doesn't.. do you know why that's happening? also is there another way to do it without a batch file like calling ping.exe directly because normally i have command and batch disabled by default and i have to enable it for this. anyway, this a is a very nice macro..if it works with others, you should submit it in the macros wiki(maybe the problem is at my end as i have so many things disabled for security reasons-i don't have an antivirus)

Options: ReplyQuote
Re: website's ip
Posted by: JamesD
Date: September 29, 2008 12:47PM

You can un-comment the #setclipboard line in the _PingBack_RunPing{ macro and then run obtain ip again. After running open notepad and paste the clipboard to it. That shows the information that was passed to the bat file. The path to write the PingBack.dat file is the third item. The first item is the path to PingBack.bat.

The re-direct ping output to file will not work without using a bat file. I spent a full day working on that before kko explained it to me.

Options: ReplyQuote
Re: website's ip
Posted by: desga2
Date: September 29, 2008 03:05PM

@ JamesD:

Why don't you make an AutoIt tool to obtain ping and send this info where you like instead to use a bat file?

K-Meleon in Spanish



Edited 1 time(s). Last edit at 09/29/2008 03:05PM by desga2.

Options: ReplyQuote
Re: website's ip
Posted by: JamesD
Date: September 29, 2008 04:09PM

@ desga2

I could but then I would have an executable to be stored and distributed. Everybody should already have ping.exe.

Options: ReplyQuote
Re: website's ip
Posted by: JamesD
Date: September 30, 2008 11:49AM

@ disrupted

Were you able to determine the problem from the information in the clipboard? Are both the macro and the batch file in your usermacro folder?

Options: ReplyQuote
Re: website's ip
Posted by: disrupted
Date: October 01, 2008 10:13PM

no james,i didn't get to test it again as i have been very busy lately with lots of work.. i'll get to it as soon as i have more time.



Edited 1 time(s). Last edit at 10/02/2008 10:40AM by disrupted.

Options: ReplyQuote
Re: website's ip
Posted by: disrupted
Date: October 02, 2008 10:40AM

fixed.. problem was i didn't have a macro folder in the profile folder, now if there's anyway to invoke the same command without a batch it'd be really great cause ping.exe can run with dos disabled but bats require enabling dos.

Options: ReplyQuote
Re: website's ip
Posted by: JamesD
Date: October 02, 2008 12:02PM

I am glad you found the problem. I was worried that only I could get it run correctly. I am sure Autoit can do the ping, but I did not want to have to store another file for distribution. Everyone should have ping installed.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.