mIRC script to check and show the pc uptime




Wouldn’t it be nice if just by issuing the command /uptime you could send to the window you have currently open a test like this?

This is what just appeared when I typed /uptime in my mIRC. Obviously my nick has been ripped off for privay reasons

 

It is much more complete than any simple uptime script which tells only your current uptime… I mean, it records you highest time!

Obviously, it requires scripting. Then, as usual, let’s see how the code works, and then let’s comment it.

Open your Aliases Panel, pressing the button, and add this code:

/checkuptime //if ($calc($ticks / 1000) > %UptimeRecord) //set %IlGiorno $asctime(d mmmm) | //if ($calc($ticks / 1000) > %UptimeRecord) //set %UptimeRecord $calc($ticks / 1000)

/uptime {
  //if ($calc($ticks / 1000) > %UptimeRecord) //set %UptimeRecord $calc($ticks / 1000)  
  //say 9,1 It is $day $+ , $time $+ , here in the Italian slumps, and 4Windows $os 9runned *cough*smoothly*cough* for8 $replace($duration($calc($ticks / 1000),2),wk,$chr(32) $+ Week,hr,$chr(32) $+ Hour,min,$chr(32) $+ Minute,day,$chr(32) $+ Day) $+ 9 $+ . Record:7 $replace($duration(%UptimeRecord,2),wk,$chr(32) $+ Week,hr,$chr(32) $+ Hour,min,$chr(32) $+ Minute,day,$chr(32) $+ Day) 9( $+ %IlGiorno $+ )
}

Now, we need to access the Remote Panel, by pressing the button, and add this line:




on 1:START:/timeruptime 0 40 /checkuptime   

or if you already have an on START in there, followed by { and some lines, insert "/timeruptime 0 40 /checkuptime" without quotes just before the } at the end.

You need to add a line also to the Variable Panel, accessible by reaching the Remote or Aliases Panels, and then clicking on the Variables tab. Here add this line:

%UptimeRecord 0

Now press OK and restart mIRC.

This script will check for you every 40 seconds if the current uptime is higher than the stored one, and if it is, updates the record, and stores also the current date. You can change the frequency the script checks the uptime by putting a different value in "/timeruptime 0 40 /checkuptime", for example use 60 instead of 40 if you want to check every minute.

Needless to say, you can, or better you must change the message as well, since as you can see it fits my being italian . Just write what you like, and format the colours and text attributes as you prefer.

This is all, type /uptime and press Enter to see the result.

Leave a Reply

Your email address will not be published. Required fields are marked *