const
  ClinicID=1;
var
  DbCfgFn,IdLstFn,FullRenumFn,RenumFn,Cmd: string;
begin
  {Get VisiQuick database configuration file}
  DbCfgFn:=GetDbCfgFnFromVqWorkDir('');
  {------------bwr------------}
  {Dump image ID's to file}
  IdLstFn:=GenerateTempFn;
  Cmd:='FindClinicImages /db="'+DbCfgFn+'" /out='+'"'+IdLstFn+'" /clinic='+IntToStr(ClinicID)+' /toothpos=bwr';
  ExecUtilsProc(Cmd);
  {patch tooth positions}
  FullRenumFn:=GenerateTempFn;
  Cmd:='PatchImageProps /db="'+DbCfgFn+'" /images="'+IdLstFn+'" /toothpos=bwr1';
  ExecUtilsProc(Cmd);
  {------------bwl------------}
  {Dump image ID's to file}
  IdLstFn:=GenerateTempFn;
  Cmd:='FindClinicImages /db="'+DbCfgFn+'" /out='+'"'+IdLstFn+'" /clinic='+IntToStr(ClinicID)+' /toothpos=bwl';
  ExecUtilsProc(Cmd);
  {patch tooth positions}
  FullRenumFn:=GenerateTempFn;
  Cmd:='PatchImageProps /db="'+DbCfgFn+'" /images="'+IdLstFn+'" /toothpos=bw11';
  ExecUtilsProc(Cmd);  
end.