home bbs files messages ]

Just a sample of the Echomail archive

Cooperative anarchy at its finest, still active today. Darkrealms is the Zone 1 Hub.

   BATPOWER      Batch Language Programming      216 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 59 of 216   
   Richard Webb to all   
   another convoluted brainteaser for the g   
   12 Jan 12 21:46:00   
   
   HI Folks,   
      
   following up a message from Richard Webb to all:   
      
   RW> One thing I've always wanted to implement was a bit of a   
   RW> history section, keyed by date.  These go out on Sunday   
   RW> mornings, of course.   
      
   RW> This batch would run at midnight utc on Sunday of course adn prepare   
   RW> the history information, compiling into it a file   
   RW> that the weekly email generator code would find.   
      
   A couple of changes since that post ...   
      
   First, I came to the brilliant realization that when HOrst's count increments   
   or decrements a numeric environment   
   variable it's going to nuke the leading 0 if it exists.   
      
   So, we rename all the files for months under 10 such as   
   315.* 518.* etc. etc.   
      
   This means we set the %NEWS% environment variable a little   
   bit differently as well, by playing with HOrst's count then   
   moving it to where we want it, to lose any leading 0 that   
   would have been generated.   
      
   AS for what happens with the month turnover, we could lose   
   the prepend leading 0 to single digit months code of course, and then use   
   ifnumber to see if %NEWS% and %TURNOVER% are   
   equal.  IF so, we reset %NEWS% to the date found in   
   %TURNOVER%   
   and call another batch.  Because of this, we also create   
   semaphores for each day in the original batch.   
      
   An example, since we'll always have the proper date for   
   Sundays we don't need to test for turnover, but on mondays ...   
                          :chkmon   
   count NEWS +1   
   ifnumber %NEWS% biggerequivalthan %TURNOVER%   
   if errorlevel 255 goto conmon   
   if errorlevel 1 goto turnover   
   goto conmon   
   :conmon   
   echo %NEWS% >> c:\hold\work\mon.sem   
   call mmsnhist.bat %NEWS%   
   if exist c:\hold\work\history.dat goto monhist   
   goto chktue   
      
   So, if turnover is reached, we branch to that label, reset   
   the env var %NEWS% and call rollhist.bat which checks for   
   the flag files, branches, and moves on.   
      
   Still open to suggestions if anybody sees an easier way to   
   roll this.   
      
      
   Regards,   
              Richard   
   ---   
    * Origin:  (1:116/901)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca