Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cause Javascript program to pause then re execute.

Status
Not open for further replies.

Work23

Technical User
Mar 8, 2005
94
US
Hello. I have this JavaScript code below. I need the code to process but then hault execution right before the end of the program for about 15 minutes, then re execute the code as a repetitive process say about a 100 times for example. Please let me know if this is possible. Thanks so much. Take care.

function InitAgenda()
{
IncludeFile("AsmLib.js",WLExecuteScript)
IncludeFile("wlSmtp.js",WLExecuteScript)
wlExpectedRepository = CopyFile("some.exr")
}



// Initialize the client and set it up to use the Smtp mail protocol
function InitClient()
{
Smtp=new WLSmtp()
Smtp.Connect("Some Smtp");
}

wlHttp.SaveSource = "Yes"
wlHttp.ExpectedDOMID = 1
wlHttp.Get("

// Retrieve the status returned by the server
StatusResponse = wlHtml.GetStatusLine()


// add an exception to prevent the script from running more than once.
if (RoundNum > 1)
{
StopGenerator("Script exiting, site is up and running.");
}
wlHttp.SaveSource = "Yes"
Sleep(2969)
wlHttp.Type = "A"; wlHttp.ExpectedLocation = ":5"; wlHttp.ExpectedID = "LogOff"; wlHttp.ExpectedName = "LogOff"; wlHttp.ExpectedText = "LOGOFF";
wlHttp.Url = wlHttp.IdentifyObject("wlHttp.ExpectedDOMID = 5
wlHttp.Get(wlHttp.Url)


// Search the HTML Source Text to find the title, the Syntax inside the match(/ /) is
// case sensitive. the word title, has to be spelled the same way that it appears in
// the HTML source file from the Website
myTitle = document.wlSource.match(/<TITLE>(.*)<\/TITLE>/)


// If the title is not "MSA e-Commerce Login" or the Status is not "OK", then trigger the email
if (myTitle[1] != "You have been logged out." || StatusResponse != "OK")
{
InfoMessage("Page could not load, an email is being sent to the webmaster")
Smtp.To="<somebody.com>";
Smtp.From= "someone.com";
Smtp.Subject="Site is down!!";
Smtp.Message="Site is DOWN!";
Smtp.Send();
InfoMessage(Smtp.GetStatusLine());
}
else
{
InfoMessage("Page Loaded Successfully")
}
 

Take a look at setInverval() for this. I think this will do exactly what you need [smile]

Cheers,
Jeff

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top