pro do_aip, adsfiles , run_time=run_time
;
;

on_error,2
if n_elements(adsfiles) eq 0 then message,'No input files'
on_error,0
run_time = 0.
start_time = systime(1)

; determine ads files to process
adsfils=adsfiles
break_file,adsfiles,log,path,adsnames,version
adschk = strtrim(adsnames(0),2)
qcompress = 0
if strpos(adschk,'PSK') ne 0 then begin         ; directory passed
    zadsfils = findfile(concat_dir(adsfils,'PSK239*Z')) ;MDM added 17-May-93
    if (zadsfils(0) ne '') then begin
    qcompress = 1
    print, 'Decompressing ADS files'
    for i=0,n_elements(zadsfils)-1 do spawn, 'uncompress "' + zadsfils(i) + '"'
    end
    
    adsfils=findfile(concat_dir(adsfils,'PSK239*'))
end

if adsfils(0) eq '' then begin
   message,/info,'No adsfiles available, returning...
endif else begin
   for i=0,n_elements(adsfils)-1 do begin
      message,/info,'Now Processing ADS file:' + adsfils(i)
      ads_into_pnt,adsfils(i), run_time=run_time0
      openu, lun, '$DIR_GEN_ADS/do_ads.log', /append, /get_lun    
      printf, lun, i, adsfils(i), '         ' , run_time0, !stime, $
      format='(1x, i5, a30, 1x, a, 3x, f7.2, 3x, a)'
      free_lun,lun
   endfor
endelse
   
if (qcompress) then for i=0,n_elements(adsfils)-1 do spawn, 'compress "' + adsfils(i) + '"'
end_time = systime(1)
run_time = (end_time-start_time)/60.
return
end