//-----------------------------------------------------------------------------
//File    : RegRead.JS
//Purpose : Sample script test for Advanced Host Monitor
//Comment : Reads registry data. Sets test's status to "Bad" when some 
//          application (or a user) changes address to a web page that Internet 
//          Explorer uses as home page
//Req     : Test's option "Translate macros" must be enabled
//Language: JScript
//Version : 1.0
//Author  : KS-Soft (www.ks-soft.net)
//-----------------------------------------------------------------------------

statusAlive       = "Host is alive:"
statusDead        = "No answer:"
statusUnknown     = "Unknown:"
statusNotResolved = "Unknown host:"
statusOk          = "Ok:"
statusBad         = "Bad:"
statusBadContents = "Bad contents:"

IEkey = "HKCU\\Software\\Microsoft\\Internet Explorer\\Main\\Start Page"

//---- entry point ----

function performtest()
{
  if ("%Reply%"=="%"+"Reply"+"%") return statusUnknown+"Please enable 'Translate macros' option";

  var WshShell, KeyStr;
  WshShell = new ActiveXObject ("WScript.Shell");
  KeyStr = WshShell.RegRead(IEkey);
  if (KeyStr!="%Reply%") return (statusBad+KeyStr); else return (statusOk+KeyStr);
}
