K-Meleon

KMeleonWiki > Resources > MacroLibrary > KmmPingBack

Submitted by: JamesD
Special thanks to Jujuland, desga2, and kko for their help.

Notes:

PingBack will call a batch file to run ping.exe to obtain the IP address. The output from ping.exe will be re-directed to a file called PingBack.dat where it is read and the IP address is added to the page title.




Open your User Macro Folder (Edit > Configuration > User-Defined Macros) or your Macro Folder (Edit > Configuration > Macros) and create the following two text file(s):

PingBack.kmm

#  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 =_("IP Address") ;
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

ping.exe -n 1 %1 > %2


Localization

\locales\fr-FR\PingBack.kml (French/Français)
Display IP number for current host=Afficher l'adresse IP de la page courante 
Obtain IP number for current host=Obtenir l'adresse IP de la page courante 
IP Address=Adresse IP 
Obtain IP=Obtenir l'adresse  
Display IP=Afficher l'adresse

\locales\es-ES\PingBack.kml (Spanish/Español)
Display IP number for current host=Muestra la dirección IP de la página actual 
Obtain IP number for current host=Obtiene la dirección IP de la página actual
IP Address=Dirección IP
Obtain IP=Obtener IP
Display IP=Mostrar IP

\locales\de-DE\PingBack.kml (German/Deutsch)
Display IP number for current host=Anzeigen-IP-Adresse des aktuellen Hosts anzeigen 
Obtain IP number for current host=IP-Adresse des aktuellen Hosts abfragen
IP Address=IP-Adresse 
Obtain IP=IP-Adresse abfragen 
Display IP=IP-Adresse anzeigen


Comments & Questions

K-Meleon

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