home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch.nt      Fun with Windows NT batch files      68,980 messages   

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

   Message 67,279 of 68,980   
   Dr J R Stockton to Herbert Kleebauer   
   Re: Level indication bar   
   28 Aug 18 02:21:42   
   
   From: J.R.Stockton@physics.org   
      
   On Monday, August 27, 2018 at 12:37:54 PM UTC+1, Herbert Kleebauer wrote:   
   > On 24.08.2018 22:52, Petr Laznovsky wrote:   
   > > Need graphically presented signal level in batch file, create a following   
   > > ...   
      
       
   > set "num=%random:~-2%"   
   >    
   > The first to digits aren't very random, but the last two are.   
      
      
   I think that %random% has a range of 0 to 32767 in Windows 7.   
      
   As you have it, therefore, values in the range 00 to 67 should be about 3%   
   more probable than the range 68 to 99 (which will not matter to the OP!).    
   That can be fixed by looping %random% until it is less than 32000 before   
   taking the last two digits (   
   which can be done arithmetically).   
      
      
   > The display is very slow and I have the feeling, it has a different   
   > speed for different values.   
      
   IIRC, for each value a long string is built up in increments of 1.  It should   
   be possible to build it up in increments of 1, 2, 4, 8, 16, 32, 64, ... .    
   Start with S0 being empty and S1 being a one-character string of space[s].   
   Successively, test the value for oddness and halve it, until it is zero; if it   
   was odd, add S1 to S0; double S1.  Or something like that.  It might well be   
   quicker, looping fewer    
   times.   
      
   I'm supposing that, if there were a direct way of replacing, for example, the   
   2 in   set "N=%R:~0,2%"   with an environment value such as %X% or !X!,   
   someone would have already suggested using it.   
      
   Also, I'd suggest using VBScript or JScript (as in a recent thread of 'mine')   
   to do the work - though using a higher-level language would be less of an   
   intellectual challenge.   
      
   In the Good Old Pre-Windows days, the screen data occupied a known region of   
   address space and could be read/written directly (though not by Batch(?)).   
      
   --    
     (c) John Stockton, near London, UK.  Using Google Groups.           |   
    Mail: J.R.""""""""@physics.org - or as Reply-To, if any.             |   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

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


(c) 1994,  bbs@darkrealms.ca