/* script to randomly display a  quote */

call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs

/* call addTicker 'debug1', DEBUG1, -3, black */

maxquotes = 999

arg filename 

if (filename = '') then
  filename = 'scripts\quote.txt'

/* if you now how many quotes are in the file, than change 
   the following line to quotenr = random(NROFQUOTES) */
quotenr = random(maxquotes)
quotefound = 0
quoteline = ''

do while lines(filename) 
  aline = linein(filename)

  if (quotefound = quotenr) then
    quoteline = quoteline' 'aline

  if (aline = '') then 
    quotefound = quotefound + 1

  if (\ (lines(filename))) then
  do
    if (quotefound < maxquotes) then 
      aline = linein(filename,1,0)

  end

end

call addTicker ' 'quoteline' ', 'QUOTE', 0, yellow, 'Helv', 80

exit
