home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / htmle96b.zip / AUTODATE.HM next >
Text File  |  1996-07-22  |  904b  |  34 lines

  1. /* .HM Macro to replace a date in the current file with a new date */
  2.  
  3. starttext = "<!-- AUTODATE -->"
  4. stoptext = "<!-- /AUTODATE -->"
  5.  
  6. /* disable the editor */
  7. call hmDisableRefresh
  8.  
  9. /* find the start and stop points for searching for the date */
  10. /* these are so we don't accidentally modify the wrong text */
  11. start = hmFind(starttext,0,,1)
  12. if start=-1 then call notfound
  13. stop = hmFind(stoptext,start,,1)
  14. if stop=-1 then call notfound
  15.  
  16. /* select the text that will be replaced */
  17. call hmSetSel start,stop-length(stoptext)
  18.  
  19. /* insert the new date */
  20. call hmInsert date()
  21.  
  22. /* inform user of success */
  23. call hmStatusSay "Updated AUTODATE!",40
  24.  
  25. /* exit the macro */
  26. call hmEnableRefresh
  27. exit
  28.  
  29. /* this procedure is called when one of the expected strings is not found */
  30. notfound: procedure
  31.     call hmStatusSay "Couldn't find AUTODATE!",40
  32.     call hmEnableRefresh
  33.     exit
  34.