Calendar Script

By QuickStep on Feb 01, 2006

Features:

/calendar to startCompletely graphical calendar!You can add/delete tasks within a reach of 12 months a head of youYou can browse months with right clickGives a notification when mirc starts if you still have undone tasks.

Fixes:Fix: Calendar in stead of Calender, woopsFix: Color Fix with backgrounds other than whiteFix: No leftover data in hash
alias calendar {
  set %calendar $iif($2,$1-,$asctime(mm yyyy))
  tokenize 32 %calendar

  var %s = $ctime($asctime(01/ $+ $1 $+ / $+ $2 $+ ) 0:00:00)

  window -aCdfk0l20p @Calendar -1 -1 420 480
  clear @Calendar
  drawtext -r @Calendar $inv Fixedsys 25 10 10 $asctime(%s, mmmm yyyy)

  ;Draw the lines
  var %line = 60
  while (%line <= 420) {
    drawline -i @Calendar 1 1 0 %line 420 %line
    drawline -i @Calendar 1 1 %line 60 %line 480
    inc %line 60
  }

  ;Fill in day notations
  var %d = 1
  while ($x(%d).1) { drawcal $inv %d 1 $v1 | inc %d }

  ;Fill in day numbers
  var %m = $asctime(%s,m), %x, %y = 2
  while ($asctime(%s,m) = %m) {
    %x = $x($asctime(%s,ddd))
    drawcal $iif($gettask($asctime(%s,dd/mm/yyyy)),$xor($inv,255), $& 
      $iif($asctime(%s,dd mm) = $asctime(dd mm),$xor($inv,16711680),$inv)) %x %y $asctime(%s,dd)
    inc %s 86400
    if (%x = 7) inc %y
  }
}
menu @Calendar {
  sclick:{
    tokenize 32 %calendar
    var %s = $ctime($asctime(01/ $+ $1 $+ / $+ $2 $+ ) 0:00:00), %a = aline -l @Calendar $+($chr(3),01,$chr(44),00), %d = $& 
      $calc($int($calc(($mouse.x / 60) + 1)) - $x($asctime(%s,ddd)) + 1 + $int($calc(($mouse.y / 60) - 2)) * 7), $&
      %date = $+($base(%d,10,10,2),/,$base($1,10,10,2),/,$2)
    !.echo -q $$ctime(%date)

    clear -l @Calendar
    %a $+ %date | %a $+ Add Task | %a $+ -
    var %n = 1
    while ($gettask(%date,%n)) { %a $+ $v1 | inc %n }
  }
  lbclick:{
    if ($1 = 2) {
      var %task = $$input(Please add a task for this day:,e,Task Add)
      addtask $strip($line(@Calendar,1,1)) %task
      aline -l @Calendar $+($chr(3),01,$chr(44),00) $+ %task
      calendar %calendar
    }
    if ($1 > 3) {
      if ($input(Mark this task as done?,y,Delete?)) {
        deltask $strip($line(@Calendar,1,1)) $calc($1 - 3)
        dline -l @Calendar $1
        calendar %calendar
      }
    }
  }
  $submenu($month_menu($1))
}
alias -l month return $gettok(January February March April May June July August September October November December,$1,32)
alias -l x {
  var %days = Mon Tue Wed Thu Fri Sat Sun
  if ($prop) return $gettok(%days,$1,32)
  else return $findtok(%days,$1,1,32)
}
alias -l drawcal drawtext -cr @Calendar $1 Fixedsys 30 $calc(($2 - 1) * 60) $calc($3 * 60) 60 60 $4-
alias -l month_menu {
  if ($1 !isnum) return -
  if ($1 isnum 1-12) {
    var %m = $iif($calc(($asctime(mm) + $1 - 1) % 12),$v1,12), %y = $calc($asctime(yyyy) + $iif(%m < $asctime(mm),1))
    return $month(%m) $chr(40) $+ %y $+ $chr(41) $+ :calendar %m %y
  }
}
alias -l inv return $xor($color($color(background)),16777215)

;-- HASH STUFF --
on *:START:{
  .hmake Calendar 10
  if ($isfile($+(",$scriptdircalendar.hsh,"))) .hload Calendar $+(",$scriptdircalendar.hsh,")
  if ($gettask($asctime(dd/mm/yyyy))) {
    beep 10 50
    $iif($input(You still have $v1 tasks for today. Open Calendar?,y,Undone Tasks),calendar)
  }
}
on *:EXIT:if ($hget(Calendar)) hsave -o Calendar $+(",$scriptdircalendar.hsh,")
alias -l gettask {
  ;$gettask(dd/mm/yyyy,N)
  var %value = $hget(Calendar,$$1)
  if (!%value) return
  if (!$2) return $numtok(%value,32)
  return $hget(Calendar,$gettok(%value,$2,32))
}
alias -l addtask {
  hinc -m Calendar total
  hadd -m Calendar $1 $hget(Calendar,$1) $+(id,$hget(Calendar,total))
  hadd -m Calendar $+(id,$hget(Calendar,total)) $$2-
}
alias -l deltask {
  .hdel Calendar $gettok($hget(Calendar,$1),$2,32)
  hadd -m Calendar $1 $deltok($hget(Calendar,$1),$2,32)
}
;--
;-- mknobbout [at] gmail [dot] com

Comments

Sign in to comment.
Xzempt   -  Jun 23, 2013

Does this script pop up some kinda of reminder on the day that the task is set for? I generally have my IRC open 24/7 so i'd like a script that gives me a reminder for a specified time on the task date

 Respond  
QuickStep   -  Feb 06, 2006

Update*: It now works with whatever background color you have!

 Respond  
StanZ   -  Feb 06, 2006

Nice one, pretty cool custom window flags and mouse capture :)
I run a blank mirc since I script myself, and I had often problems with irc palette and theme.

 Respond  
WDragon   -  Feb 04, 2006

how do i change the colours in the calender becouse i also use a black background

 Respond  
No0ne   -  Feb 01, 2006

Works good. Do you plan on updating this (adding options)?

 Respond  
bearruler   -  Feb 01, 2006

Its a good script, but I have a black background (like StonedStoner) and cant see the lines
I had to change my bg color to grey to see the calendar

You could use the $color identifier to make sure it wasnt the same color as their background

Bear

 Respond  
`Kazuma   -  Feb 01, 2006

nice

 Respond  
QuickStep   -  Feb 01, 2006

After experimenting a bit with my script I noticed that mirc\'s time doesnt go any further than January 19th 2038. Heh interesting to know

 Respond  
StonedStoner   -  Feb 01, 2006

After that was fixed its very good. Nice job.

 Respond  
StonedStoner   -  Feb 01, 2006

I have a black background and the days don\'t show up.

 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.