home *** CD-ROM | disk | FTP | other *** search
/ HomeWare 14 / HOMEWARE14.bin / prog / fdate80a.arj / TIC.BAT < prev    next >
DOS Batch File  |  1993-07-20  |  7KB  |  196 lines

  1. @echo off
  2. goto EndDoC
  3. ---------------------------------------------------------------------
  4. If environment variable RAMDISK is set before running this batch
  5. file, then it will use the RAM disk and run a bit faster.
  6.  
  7. revision history
  8. ================
  9. Jan 15, 1992
  10.     Added ability to accept +1, etc. as parms
  11. Jan 22, 1992
  12.     Fixed ability to list by date, which had been messed up when
  13.       adding ability to accept +1, etc. as parms
  14. Mar 25, 1992
  15.     Changed date format from mm-dd-ccyy to ccyy-mm-dd
  16.     This makes it easier to sort tickler.bat by date
  17.     NOTE THAT THIS IS INCOMPATIBLE WITH EARLIER VERSIONS OF TIC
  18.     Use "TIC EDIT" to edit old dates in TICKLER.BAT
  19. May 1 , 1992
  20.     slightly re-arranged things to make it run faster
  21. ---------------------------------------------------------------------
  22. :EndDoC
  23.  
  24. REM TicBAT points to the tickler batch file
  25. set TicBAT=C:\TICKLER.BAT
  26. set ticdat=
  27. set ticdow=
  28. set ticmsg=
  29. set tictmp=
  30.  
  31. if (%1)==(t) goto listplus
  32. IF (%1)==(T) GOTO LISTPLUS
  33. for %%v in (today TODAY Today  ) do if (%%v)==(%1) goto LISTPLUS
  34.  
  35. for %%v in (ed Ed ED edit Edit EDIT) do if (%%v)==(%1) goto EDIT
  36. for %%v in (dow DOW Dow DoW) do if (%%v)==(%1) goto adddow
  37. if (%1)==() goto HELP
  38.  
  39. for %%v in (t+1 T+1) do if (%%v)==(%1) %0 T +1
  40. for %%v in (t+2 T+2) do if (%%v)==(%1) %0 T +2
  41. for %%v in (t+3 T+3) do if (%%v)==(%1) %0 T +3
  42. for %%v in (t+4 T+4) do if (%%v)==(%1) %0 T +4
  43. for %%v in (t+5 T+5) do if (%%v)==(%1) %0 T +5
  44. for %%v in (t+6 T+6) do if (%%v)==(%1) %0 T +6
  45. for %%v in (t+7 T+7) do if (%%v)==(%1) %0 T +7
  46. if (%2)==() goto LISTDATE
  47. goto add
  48.  
  49. :LISTDATE
  50. if not exist %TicBAT% goto endit
  51. Fdate /Ff /A%1 /Imm-dd-yy /Occyy-mm-dd /P"@set today=" >%RAMDISK%JUNKTEMP.BAT
  52. call %RAMDISK%JUNKTEMP.BAT
  53. goto LISTIT
  54.  
  55. :LISTPLUS
  56. if not exist %TicBAT% goto endit
  57.  
  58. set TICFUT=%2
  59. IF (%ticfut%)==() SET TICFUT=0
  60.  
  61. Fdate /Fadd /At /N%TICfut% /Occyy-mm-dd /P"@set today=" >%RAMDISK%JUNKTEMP.BAT
  62. call %RAMDISK%JUNKTEMP.BAT
  63. set TICfut=
  64. rem fall thru ...
  65.  
  66. :LISTIT
  67. if (%today%)==(ERROR) goto ERROR1
  68.  
  69. rem ------- call batch file to set ticdow Evar -------
  70. Fdate /Ff /A%today% /Odow# /Iccyy-mm-dd /P"@set ticdow=">%RAMDISK%JUNKTEMP.BAT
  71. call %RAMDISK%JUNKTEMP.BAT
  72.  
  73. echo ───────────────────────────────────────────────────────────────────────────────
  74. FDATE /Ff /A%today% /Iccyy-mm-dd /P"APPOINTMENTS & THINGS TO DO: "
  75. echo ───────────────────────────────────────────────────────────────────────────────
  76. CALL %TicBAT%
  77. goto endit
  78.  
  79. :ERROR1
  80. echo Invalid date parameter [%1] received by %0
  81. goto endit
  82.  
  83. :ADD
  84. rem -------------------------------------------------------------
  85. rem use a batch file to set ticdat, because it will display full error
  86. rem message if bad date has been passed in via parm %1
  87. rem -------------------------------------------------------------
  88. Fdate /Ff /A%1 /Imm-dd-yy /Occyy-mm-dd /P"@set ticdat=" >%RAMDISK%JUNKTEMP.BAT
  89. call %RAMDISK%JUNKTEMP.BAT
  90. if errorlevel 1 goto endit
  91.  
  92. set tictmp=%0 %1
  93.  
  94. shift
  95. set ticmsg=%1
  96. shift
  97.  
  98. :LOOPTOP1
  99. if (%1)==() goto LOOPEND1
  100. set ticmsg=%ticmsg% %1
  101. shift
  102. goto LOOPTOP1
  103. :LOOPEND1
  104.  
  105. if exist %TicBAT% goto exists1
  106. echo @echo off >> %TicBAT%
  107. :exists1
  108. echo if (%%today%%)==(%ticdat%) echo %ticmsg%>>%TicBAT%
  109. CLS
  110. %tictmp%
  111. goto endit
  112.  
  113.  
  114.  
  115. :ADDDOW
  116. set tictmp=%0 %1
  117. rem -------------------------------------------------------------
  118. rem use a batch file to set ticdat, because it will display full error
  119. rem message if bad date has been passed in via parm %1
  120. rem -------------------------------------------------------------
  121. set ticdow=
  122. for %%v in ( 1 2 3 4 5 6 7 ) do if (%2)==(%%v) set ticdow=%2
  123. if (%ticdow%)==() echo Invalid day-of-week number: %2
  124. if (%ticdow%)==() goto endit
  125.  
  126. shift
  127. shift
  128. set ticmsg=%1
  129. shift
  130. :LOOPTOP2
  131. if (%1)==() goto LOOPEND2
  132. set ticmsg=%ticmsg% %1
  133. shift
  134. goto LOOPTOP2
  135. :LOOPEND2
  136.  
  137. IF (%TICDOW%)==(1) SET TICMSG=%ticmsg% [REGULAR SUNDAY APPOINTMENT]
  138. IF (%TICDOW%)==(2) SET TICMSG=%ticmsg% [REGULAR MONDAY APPOINTMENT]
  139. IF (%TICDOW%)==(3) SET TICMSG=%ticmsg% [REGULAR TUESDAY APPOINTMENT]
  140. IF (%TICDOW%)==(4) SET TICMSG=%ticmsg% [REGULAR WEDNESDAY APPOINTMENT]
  141. IF (%TICDOW%)==(5) SET TICMSG=%ticmsg% [REGULAR THURSDAY APPOINTMENT]
  142. IF (%TICDOW%)==(6) SET TICMSG=%ticmsg% [REGULAR FRIDAY APPOINTMENT]
  143. IF (%TICDOW%)==(7) SET TICMSG=%ticmsg% [REGULAR SATURDAY APPOINTMENT]
  144.  
  145. if exist %TicBAT% goto exists2
  146. echo @echo off >> %TicBAT%
  147. :exists2
  148. echo if (%%ticdow%%)==(%ticdow%) echo %ticmsg%>>%TicBAT%
  149. CLS
  150. echo Added: %ticmsg%
  151. goto endit
  152.  
  153.  
  154. :HELP
  155. REM use ansi.sys to set color to blue
  156. echo 
  157. cls
  158. echo ┌─────────────────────────────────────────────────────────────────────────────┐
  159. echo │ TIC.BAT  : maintains and displays TICKLER.BAT, an automated tickler file.   │
  160. echo │═════════════════════════════════════════════════════════════════════════════│
  161. echo │  Usage   : TIC           displays this HELP screen                          │
  162. echo │─────────────────────────────────────────────────────────────────────────────│
  163. echo │  Usage   : TIC T         displays today's    appointments                   │
  164. echo │  Usage   : TIC T  +1     displays tomorrow's appointments                   │
  165. echo │─────────────────────────────────────────────────────────────────────────────│
  166. echo │  Usage   : TIC ED (or TIC EDIT)   calls text editor to edit TICKLER.BAT     │
  167. echo │─────────────────────────────────────────────────────────────────────────────│
  168. echo │  Usage   : TIC mm/dd/yy  displays appointments for date mm/dd/yy            │
  169. echo │  EXAMPLE : TIC 2/2/92    displays appointments for Feb 2, 1992              │
  170. echo │  EXAMPLE : TIC 2/2/tt    displays appointments for Feb 2 of this year       │
  171. echo │─────────────────────────────────────────────────────────────────────────────│
  172. echo │  Usage   : TIC mm/dd/yy  words ...     adds an appointment for date         │
  173. echo │                                        [mm/dd/yy]  to TICKLER.BAT           │
  174. echo │  EXAMPLE : TIC 2/2/92    Quality Improvement committee meeting @ 10 am      │
  175. echo │  EXAMPLE : TIC 2/2/tt    Quality Improvement committee meeting @ 10 am      │
  176. echo │─────────────────────────────────────────────────────────────────────────────│
  177. echo │  Usage   : TIC DOW dow#  words ...     adds a regular appointment           │
  178. echo │                                        for [dow#] day to TICKLER.BAT        │
  179. echo │  EXAMPLE : TIC DOW 2     Regular Monday-morning staff  meeting @ 8:30       │
  180. echo └─────────────────────────────────────────────────────────────────────────────┘
  181. REM use ansi.sys to set color to normal default colors
  182. echo  A
  183. goto endit
  184.  
  185. :EDIT
  186. SPFPC %TicBAT%
  187. goto endit
  188.  
  189. :endit
  190. set ticdow=
  191. set fdate=
  192. set ticdat=
  193. set ticmsg=
  194. set TicBAT=
  195. if exist %RAMDISK%JUNKTEMP.BAT del %RAMDISK%JUNKTEMP.BAT >nul
  196.