Timer Info Dialog

By smilinbob on Sep 15, 2010

Screenshots

This is a small snippet I created to track active timers.
It lists all active timers by: name, command, and time remaining.
You can kill any timer or get additional information on it, with the buttons on the bottom. Pop-up menu "Timers" is added to Channel and status windows.

I made this mostly so i can practice with making custom dialogs.

To use: save to new file (ie: timers.mrc) and load it in mirc.

Note: there is a small bug I am trying to work out with ms timers.
The "Delay" info will be wrong if the timer is using milliseconds. (unless it's a multimedia timer)

dialog -l timers {
  title "TIMERS"
  size -1 -1 218 75
  option dbu
  list 1, 2 8 70 50, size
  list 2, 74 8 70 50, size
  list 3, 146 8 70 50, size
  text "Name", 5, 2 0 14 8
  text "Command", 6, 74 0 24 8
  text "Time", 7, 146 0 24 8
  button "Refresh", 8, 38 60 35 12
  button "Info", 9, 74 60 35 12
  button "Kill", 10, 110 60 35 12
  button "Close", 4, 146 60 35 12, ok
}
dialog -l info {
  title "Timer Info"
  size -1 -1 93 190
  option dbu
  text "Additional Info", 26, 24 3 35 8
  text "Name:", 13, 5 15 22 8
  text "Timer ID:", 14, 5 25 22 8
  text "Reps:", 15, 5 35 14 8
  text "Delay", 16, 5 45 14 8
  text "Type:", 17, 5 55 14 8
  text "Remaining:", 18, 5 65 27 8
  text "Multimedia Timer:", 19, 5 75 42 8
  text "anysc:", 20, 5 85 16 8
  text "WID:", 211, 5 95 13 8
  text "CID:", 22, 5 105 11 8
  text "HWND:", 23, 5 115 18 8
  text "", 1, 55 15 31 8
  text "", 2, 55 25 31 8
  text "", 3, 55 35 31 8
  text "", 4, 55 45 31 8
  text "", 5, 55 55 31 8
  text "", 6, 55 65 31 8
  text "", 7, 55 75 31 8
  text "", 8, 55 85 31 8
  text "", 9, 55 95 31 8
  text "", 10, 55 105 31 8
  text "", 11, 55 115 31 8
  box "Command", 24, 4 129 85 44
  button "DONE", 25, 27 176 37 12, ok
  text "", 12, 6 138 78 31
}
alias -l ref {
  .timerttime 0 1 /ttime
  did -r timers 1-3
  var %td = $timer(0)
  var %t2 = 1
  while (%t2 <= %td) {
    did -a timers 1 $timer(%t2)
    did -a timers 2 $timer(%t2).com
    did -a timers 3 $duration($timer(%t2).secs,3)
    inc %t2
  }
}
alias -l ttime {
  var %t = $did(timers,1).lines
  var %n = 1
  while (%n <= %t) {
    did -o timers 3 %n $duration($timer($did(timers,1,%n)).secs,3)
    inc %n
  }
  did -c timers 3 $did(timers,1).sel
}
on *:dialog:timers:init:*: { 
  ttime
  .timerttime 0 1 /ttime
  ref
}
on *:dialog:timers:sclick:*: {
  if ($did == 1) {
    did -c timers 2 $did(timers,1).sel
    did -c timers 3 $did(timers,1).sel
  }
  elseif ($did == 2) {
    did -c timers 1 $did(timers,2).sel
    did -c timers 3 $did(timers,2).sel
  }
  elseif ($did == 3) {
    did -c timers 1 $did(timers,3).sel
    did -c timers 2 $did(timers,3).sel
  }
  elseif ($did == 8) { ref }
  elseif ($did == 9) {
    set %ti $did(timers,1,$did(timers,1).sel).text
    dialog -m info info
  }
  elseif ($did == 10) {
    timer [ $+ [ $did(timers,1,$did(timers,1).sel).text ] ] off
    ref
  }
}
on *:dialog:timers:close:*: {
  .timerttime off
}
on *:dialog:info:init:*: {
  var %n = %ti
  unset %ti
  did -a info 1 %n
  did -a info 2 $timer(%n)
  did -a info 3 $timer(%n).reps
  if ($timer(%n).mmt) {
    did -a info 4 $duration($calc($timer(%n).delay / 1000),3)
  }
  else {
    did -a info 4 $duration($timer(%n).delay,3)
  }
  did -a info 5 $timer(%n).type
  did -a info 6 $duration($timer(%n).secs,3)
  did -a info 7 $iif($timer(%n).mmt,Yes,No)
  did -a info 8 $iif($timer(%n).anysc,Yes,No)
  did -a info 9 $timer(%n).wid
  did -a info 10 $timer(%n).cid
  did -a info 11 $timer(%n).hwnd
  did -a info 12 $timer(%n).com
}
menu channel,status {
  .Timers:/dialog -m timers timers
}

Comments

Sign in to comment.
Cheiron   -  Sep 15, 2010

Nice little script and accurate too. shows all what is running correctly and is able to kill proccess, reset them etc etc with no errors with testing.

good job :)

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.