2015-04-07

Command line calendar for Windows

I created a command line calendar utility that others may find useful. Download the zip file from here. I originally coded this as an exercise in Turbo Pascal, translated into Delphi, then recently recoded into PureBasic which can create tightly compiled stand alone console executables - about one quarter the size of Delphi executables.

You can use the utility to create a MSWord doc using a mono font like Courier, by redirecting the output to a file:
cal > cal.txt
You can even fit three full years on one A4 page if you change MSWord's page orientation to landscape and reduce the margins
cal n=36 w=6 > cal.txt

Usage: cal Y=nnnn M=nn N=nn W=[1,2,3,4,6,12] S=nn T
Y = year of calendar; default=current year; cal Y=2000
YX = year of calendar without correction for 0-99
M = start month; default=1 (January)
N = number of months; default=12
W = nr months in a row; default=3
S = nr horizontal spaces between months; default=3
T = use tab instead of spaces - good for export to spreadsheet; cal T > caltab.txt


January 2015           February 2015          March 2015        
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
             1  2  3    1  2  3  4  5  6  7    1  2  3  4  5  6  7
 4  5  6  7  8  9 10    8  9 10 11 12 13 14    8  9 10 11 12 13 14
11 12 13 14 15 16 17   15 16 17 18 19 20 21   15 16 17 18 19 20 21
18 19 20 21 22 23 24   22 23 24 25 26 27 28   22 23 24 25 26 27 28
25 26 27 28 29 30 31                          29 30 31          
                                                                
April 2015             May 2015               June 2015         
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
          1  2  3  4                   1  2       1  2  3  4  5  6
 5  6  7  8  9 10 11    3  4  5  6  7  8  9    7  8  9 10 11 12 13
12 13 14 15 16 17 18   10 11 12 13 14 15 16   14 15 16 17 18 19 20
19 20 21 22 23 24 25   17 18 19 20 21 22 23   21 22 23 24 25 26 27
26 27 28 29 30         24 25 26 27 28 29 30   28 29 30          
                       31                                       
July 2015              August 2015            September 2015    
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
          1  2  3  4                      1          1  2  3  4  5
 5  6  7  8  9 10 11    2  3  4  5  6  7  8    6  7  8  9 10 11 12
12 13 14 15 16 17 18    9 10 11 12 13 14 15   13 14 15 16 17 18 19
19 20 21 22 23 24 25   16 17 18 19 20 21 22   20 21 22 23 24 25 26
26 27 28 29 30 31      23 24 25 26 27 28 29   27 28 29 30       
                       30 31                                    
October 2015           November 2015          December 2015     
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
             1  2  3    1  2  3  4  5  6  7          1  2  3  4  5
 4  5  6  7  8  9 10    8  9 10 11 12 13 14    6  7  8  9 10 11 12
11 12 13 14 15 16 17   15 16 17 18 19 20 21   13 14 15 16 17 18 19
18 19 20 21 22 23 24   22 23 24 25 26 27 28   20 21 22 23 24 25 26
25 26 27 28 29 30 31   29 30                  27 28 29 30 31