quote:
Originally posted by JonnyT
for uptime you could use this:
code:
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <darktempler@gmail.com> wrote this file. As long as you retain this notice you
* can do whatever you want with my code. If we meet some day, and you think
* this code is worth it, you can buy me a beer in return - Matt Labrum (-dt-)
* ----------------------------------------------------------------------------
*/
function getUptime(){
var uptime = wmi('Win32_OperatingSystem').LastBootUpTime;
var start = dateTimetoRealTime(uptime).getTime();
var now = new Date().getTime();
var secs = Math.round((now - start) / 1000);
var st = '';
var days = removeDec(secs / 86400);
if(days >= 1){
if(days == 1){
st += days + ' day ';
}else{
st += days + ' days ';
}
secs = secs - (days * 86400);
}
var hours = removeDec(secs / 3600);
if(hours >= 1){
if(hours == 1){
st += hours + ' hour ';
}else{
st += hours-1 + ' hours ';
}
secs = secs - (hours * 3600)
}
var mins = removeDec(secs / 60);
if(mins >= 1){
if(mins == 1){
st += mins + ' minute ';
}else{
st += mins + ' minutes ';
}
secs = secs - (mins * 60);
}
st += 'and ' + secs + ' seconds'
return st;
}
How to use this exactly ? Can you make a script please.