|
Joined: Jun 2005
Posts: 127
Vogon poet
|
OP
Vogon poet
Joined: Jun 2005
Posts: 127 |
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: <?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.
Last edited by HAMM3R; 11/08/05 08:04 PM.
|
|
|
|
Joined: Jun 2005
Posts: 127
Vogon poet
|
OP
Vogon poet
Joined: Jun 2005
Posts: 127 |
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 ?
|
|
|
|
Joined: Nov 2003
Posts: 2,321
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,321 |
//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))
|
|
|
|
Joined: Oct 2004
Posts: 8,061
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,061 |
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.
|
|
|
|
Joined: Jun 2005
Posts: 127
Vogon poet
|
OP
Vogon poet
Joined: Jun 2005
Posts: 127 |
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: $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: 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!
|
|
|
|
Joined: Aug 2005
Posts: 128
Vogon poet
|
Vogon poet
Joined: Aug 2005
Posts: 128 |
That's nice  P.S. I added this post cos I had 13 totally posts, and 13 is unlucky number, so I wanted to have 14 
|
|
|
|
|