mIRC Home    About    Download    Register    News    Help

Print Thread
#127290 11/08/05 08:03 PM
Joined: Jun 2005
Posts: 127
H
HAMM3R Offline OP
Vogon poet
OP Offline
Vogon poet
H
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:
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.

Last edited by HAMM3R; 11/08/05 08:04 PM.

-- HAMM3R (aka: alhammer)
http://www.HAMM3R.net
#127291 11/08/05 08:07 PM
Joined: Jul 2005
Posts: 40
K
Ameglian cow
Offline
Ameglian cow
K
Joined: Jul 2005
Posts: 40
/help $uptime


have fun


j0k3r @ k4s.ch
#127292 11/08/05 08:30 PM
Joined: Jun 2005
Posts: 127
H
HAMM3R Offline OP
Vogon poet
OP Offline
Vogon poet
H
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 ?


-- HAMM3R (aka: alhammer)
http://www.HAMM3R.net
#127293 11/08/05 10:30 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
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))


New username: hixxy
#127294 12/08/05 01:30 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
#127295 12/08/05 07:46 PM
Joined: Jun 2005
Posts: 127
H
HAMM3R Offline OP
Vogon poet
OP Offline
Vogon poet
H
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:
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!


-- HAMM3R (aka: alhammer)
http://www.HAMM3R.net
#127296 13/08/05 12:21 AM
Joined: Aug 2005
Posts: 128
S
Vogon poet
Offline
Vogon poet
S
Joined: Aug 2005
Posts: 128
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


Link Copied to Clipboard