mIRC Homepage

uptime

Posted By: HAMM3R

uptime - 11/08/05 08:03 PM

Hello. I'd like to retrieve the uptime of my system using uptime.exe (a microsoft app). I can get the uptime with it using:
Code:
 <?php
    echo 'Uptime: ';
    print exec("c:/uptime.exe");
?>
So how might i do the same with mirc? I know it involves the COM and dos prompt. Any idea? TIA!

Thanks,
Austin

EDIT: I know there are a million DLLs to do this, but for various reasons, i'd like to do it with uptme.exe if its possible.
Posted By: Karas

Re: uptime - 11/08/05 08:07 PM

/help $uptime


have fun
Posted By: HAMM3R

Re: uptime - 11/08/05 08:30 PM

ok. well here is the thing. I need it to be in this format:
0 day(s), 1 hour(s), 40 minute(s), 1 second(s)

How can i make it look like that if you want me to use $uptime ?
Posted By: tidy_trax

Re: uptime - 11/08/05 10:30 PM

Code:
//echo -a $iif(*day* !iswm $gettok($uptime(system,1),1,32),0 day(s)) $replace($uptime(system,1),days,$chr(32) day(s),hrs,$chr(32) hour(s),mins,$chr(32) minute(s),secs,$chr(32) second(s))
Posted By: Riamus2

Re: uptime - 12/08/05 01:30 PM

If you need months and years in the output and you don't need 0's displayed, you can use this script to do it.

Use:
//echo -a $datexpander($duration($uptime(system|mirc|network)))

*Use only one of the $uptime types above.
Posted By: HAMM3R

Re: uptime - 12/08/05 07:46 PM

Thanks to all of you. I edited it just a little to make it match completely. Plus i had to add "hr" in case the uptime is 1 hour, it will still appear as "1 hour(s). So here is what i came up with:
Code:
$iif(*day* !iswm $gettok($uptime(system,1),1,32),0 day(s)) $+ , $replace($uptime(system,1),days,$chr(32) day(s) $+ $chr(44),hrs,$chr(32) hour(s) $+ $chr(44),mins,$chr(32) minute(s) $+ $chr(44),secs,$chr(32) second(s),hr,$chr(32) hour(s) $+ $chr(44))
I made an /uptimes alias to show both my local uptime, and my Winserver's uptime. I wanted them to match, thats why i needed this special formatting. Check out what /uptimes shows:
Quote:
Local Uptime: 0 day(s), 1 hour(s), 5 minute(s), 54 second(s)
WinServer Uptime: 0 day(s), 18 hour(s), 39 minute(s), 41 second(s)
Again, THANKS!
Posted By: stefys99

Re: uptime - 13/08/05 12:21 AM

That's nice smile

P.S. I added this post cos I had 13 totally posts, and 13 is unlucky number, so I wanted to have 14 smile
© 2021 mIRC Discussion Forums