Clock

By Tamaki on May 21, 2009

This script does NOT require my integration script. It's just something fun that I decided to throw together. This script does use the $p.bar script from Jersey44 which can be found here: http://www.hawkee.com/snippet/5935/ (you don NOT have to go download this script, as I have included it in this script).

I will not make any further changed to this script unless I'm absolutely convinced to make it look cooler or add a gazillion new features. =)

Load into your remotes and type /clock
Enjoy!

You can also type /clock -m to have it open up on IRC instead of the desktop.

Image

dialog clock {
  title Clock
  option dbu
  size -1 -1 201 77
  text "Date", 1, 1 1 200 10, center
  text "", 2, 1 11 200 10, center
  text "Time", 3, 1 22 200 10, center
  text "", 4, 1 33 200 10, center
  text "Hours", 5, 1 44 20 10
  text "", 6, 41 44 50 10
  text "Minutes", 7, 1 55 20 10
  text "", 8, 41 55 179 10
  text "Seconds", 9, 1 66 20 10
  text "", 10, 41 66 179 10
  radio "AM", 11, 92 44 50 10, disable
  radio "PM", 12, 143 44 50 10, disable
}

on *:DIALOG:clock:init:*: {
  timecheck
}

on *:DIALOG:clock:close:*: {
  .timert* off
}

alias timecheck {
  .timertime 1 1 timecheck
  did -ra clock 2 $asctime(dddd - mmmm dd - yyyy)
  did -ra clock 4 $asctime(hh:nn:ss TT)
  var %temp.h1 $ceil($asctime(hh))
  var %temp.h2 12
  var %temp.m1 $ceil($asctime(nn))
  var %temp.m2 59
  var %temp.s1 $ceil($asctime(ss))
  var %temp.s2 59
  If (%temp.h1 > 0) {
    did -ra clock 6 $p.bar(%temp.h1 $+ / $+ %temp.h2).s
  }
  Else {
    did -ra clock 6 $p.bar(.01/12).s
  }
  If (%temp.m1 > 0) {
    did -ra clock 8 $p.bar(%temp.m1 $+ / $+ %temp.m2).s
  }
  Else {
    did -ra clock 8 $p.bar(.01/59).s
  }
  If (%temp.s1 > 0) {
    did -ra clock 10 $p.bar(%temp.s1 $+ / $+ %temp.s2).s
  }
  Else {
    did -ra clock 10 $p.bar(.01/59).s
  }
  If ($asctime(TT) == AM) {
    did -c clock 11
    did -u clock 12
  }
  Else {
    did -c clock 12
    did -u clock 11
  }
}

alias clock {
  If (-m isin $1) {
    dialog -m clock clock
  }
  Else {
    dialog -md clock clock
  }
}

alias p.bar {
  var %open.char = 1,0[
  var %clos.char = 1,0]
  var %pbar.fill = 2,0|
  var %pbar.empt = 2,0.
  if ($regex($1,\d*/\d*$)) { var %p1 = $gettok($1,1,47)), %p2 = $calc($gettok($1,2,47) - %p1) }
  elseif ($regex($1,^\d*%$)) { var %p1 = $calc($remove($1,%) / 10)), %p2 = $calc(10 - %p1)) }
  if (%p1) {
    var %r = $+(%open.char,$str(%pbar.fill,%p1),$str(%pbar.empt,%p2),%clos.char,$iif($right(%clos.char,-1) != ,))
    return $iif($prop == s,$strip(%r),%r) 
  }
  else { return 2* $!pbar: error }
}

Comments

Sign in to comment.
Tamaki   -  May 24, 2009

not a problem =D

 Respond  
}{exer   -  May 24, 2009

Nice Idea , thank you :))

 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.