Ver Mensaje Individual
  #8  
Antiguo 30-12-2005
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
A ver si es esto...

const PATH='C:\EJEMPLO\';Function TForm1.NuevoNombre: string;var s1,s2,max: string; sr: TSearchRec; sw: integer;begin // COMPONER PRIMERA PARTE DEL NOMBRE s1:='HPIM03'+copy(DateToStr(Date),1,2)+copy(DateToStr(Date),4,2)+ copy(DatetoStr(Date),7,4); s1:= s1 + copy(TimeToStr(Time),1,2)+copy(TimeToStr(Time),4,2)+ copy(TimeToStr(Time),7,2); sw := FindFirst(PATH+'HPIM03*.*',$3F,sr); max:= '01'; // ALMACENA EL Nº MAYOR while sw = 0 do begin // 22= POSICION DE Nº CONSECUTIVO Ej: 01,02,etc if copy(sr.Name,22,2)> max then max:= copy(sr.Name,23,2); FindNext(sr); end; sw := StrToInt(max); inc(sw); s2 := IntToStr(sw); s2:= '['+copy('00',1,2-length(s2))+s2+']'; s1 := s1 + s2; Result:= s1end;
Responder Con Cita