--- In [email protected], "qzzyyx" <blackh...@...> wrote:
> 
> The whole chore ... find the newest/oldest file in a directory
> (by any of the three file times) and ShellExecute it (or return
> its name to be started by PowerPro's usual mechanism). 

Did you see the script in my other post?

Anyway, not hard (although I haven't researched "access date", if that is 
really needed). Following only addresses date modified and date created.

You could save the following in a file named NewOld.powerpro in the scripts 
folder within the folder housing your pcf file, and e.g. put in the command 
block: do(.newold(pprofolder++"*.txt","m"))

Instead of quit(selfile) in below script, you could have do(selfile) and then 
you wouldn't need do in the command block.

Regards,
Sheri

args listfilepath, datetype, b_oldest
;listfilepath can include wildcards
;datetype can be m (for modified) c (for created)
;if b_oldest, gets oldest, otherwise newest
if (regex.pcrematch(?"(?i)[cm]",datetype) !==1) do
  messagebox("OK", "Bad datetype, use c or m only.")
  quit
endif
local seldate,selfile
if (b_oldest)
  seldate=99999999999999
for each line thisfile in file.listfiles(listfilepath)
  if (b_oldest) do
    if (file.getdate(thisfile,datetype) < seldate) do
      seldate=file.getdate(thisfile,datetype)
      selfile=thisfile
    endif
  else
    if (file.getdate(thisfile,datetype) > seldate) do
    seldate=file.getdate(thisfile,datetype)
    selfile=thisfile
    endif
  endif
endfor
;win.debug(ifelse(b_oldest,"Oldest", "Newest"), listfilepath)
;win.debug(formatdate("shortdate",slice(seldate,8)), ;;+
;  formattime("HH:mm:ss",remove(seldate,8)),"selfile:", selfile)
quit(selfile)


Reply via email to