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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Difficulties opening/closing links/applications on a javascript timer

Status
Not open for further replies.

gregmacca

IS-IT--Management
Aug 7, 2002
13
0
0
GB
Hello

I am trying to write some code in javascript to open a link at a certain time and then close it later. I have no trouble getting the link to open when the desired time is set. The problem is getting the 'link' to close as the link launches real player (to play a radio station) and so I was wondering if anyone can tell me if there is a way to close real player from the same script in the html page. If not can I use another scripting/programming language or are there any freeware programs that will end programs/applications on a timer.

The code I have already is -

<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<HTML><HEAD>
<META http-equiv=Content-Type content=&quot;text/html; charset=windows-1252&quot;>
<SCRIPT language=Javascript><!--
function Clock(){

var today = new Date(); // Get current time.
var d = today.getDay(); // Extract Day.
var h = today.getHours(); // Extract hours.
var m = today.getMinutes(); // Extract minutes.
var s = today.getSeconds(); // Extract seconds.

if (m < 10) m = &quot;0&quot; + m; // Convert 0 minutes to 00 minutes, etc.
if (s < 10) s = &quot;0&quot; + s; // Convert 0 seconds to 00 seconds, etc.
var t = h+ ':' +m+ ':' +s+ ' '; // Put it all together.
document.clock.time.value = t ; // Display it in a text box.
// Arrange to do it all again in 1 sec
setTimeout(&quot;Clock()&quot;, 1000); // 1000 ms is 1 second.

{
if (h == 21 & m == 29 & s == 00)
window.location=&quot; }
{ if (h == 21 & m == 29 & s == 15)
close.window(realplay.exe); ???? IT IS THIS LINE THAT IS THE PROBLEM
}
}

//--></SCRIPT>

<META content=&quot;MSHTML 6.00.2600.0&quot; name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff onload=Clock() ?><BR><BR>
<FORM name=clock><INPUT size=10 name=time></FORM></BODY></HTML>


Thanks in advance

Greg
 
not if you're just loading a .ram file...most likely the browser will open the appropriate program to handle the .ram file and the browser will close. js will have no access to the associated program.

if you can write a page that would load the sound file in the page itself, then js can close that page at will.



=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top