'RBLD_ALL - rebuild all key files in directory
external   strtoary() fgi bgi fgp bgp progress() sch scw vloadif() dpath
external   messbox() remove() vunloadif() messboxwait()

public     ptary[1] ptval $file #rec_st #rec_fin ptstr $key

global     names i nextproj firstline x  $files nextdrive
global     $module $c RebuildKeys() lk

MAIN
single-step off
  screen clear box 1 1 sch scw 0 0 no-border
  repaint off
'   quiet off
  error off
message "Set to work on"&dpath&"drive"
  remove("keylist.txt")
  tools os "dir F:\data\*.key /O:N /B > e:\programs\keylist.txt"
  progress(fgp,bgp," Reading program files ",0)
  fopen "keylist.txt" as 4
  while eof(4) = 0
    fread 4 into $file
    lk=len($file)
    $file=left($file,lk-3)
    $file=$file|"vws"
' message "$file is:"&str($file)
    RebuildKeys()
  end while
  fclose 4
END MAIN


FUNCTION RebuildKeys()
local $module  y y1 y2 $filename
  screen clear box 1 1 sch scw 0 0 no-border
  repaint off
  progress(fgp,bgp," Rebuilding keys for"&upper($file),0)
' repaint on
' repaint
' single-step on
'   if file(dpath|$file)=0         ' message "Making new index"
'     messboxwait(" No DB file for"&$file,0,0,1)
'     return (1)
'   end if
  vloadif(dpath|$file)
' file load standard-view "f:\data\products"
  order key rebuild
  vunloadif($file)
END FUNCTION ' CompileFiles()


