local InFile = file.open(arg(1), "r") local OutName = ifelse(arg(0) == 2, arg(2) ++ "_NameDateFile.lst", arg(3)) if(file.validpath(OutName) != 1) do messagebox("ok error", "Invalid file path " ++ OutName, "FILE plugin error #1") quit endif local OutFile = file.open(OutName, "r") local Str, Counter, List, i, j, Date, Time, Temp, Rex flag clear 1 if(InFile > 0) do for(not(file.eof(InFile))) Str = file.readstring(InFile) if(Str != 0) Counter = Counter + 1 endfor else messagebox("ok error", "File not opened", "FILE plugin error #3") quit endif if(Counter == 1) do List = file.listfiles(arg(2), 0, 0) Counter = line(List, 0) flag set 1 else file.restart(InFile) endif if(OutFile > 0) do for(not(file.eof(OutFile))) Str = file.readstring(OutFile) if(Str != 0) do Rex = Rex + 1 endif endfor else messagebox("ok error", "File not opened", "FILE plugin error #3") quit endif if(Rex % 3 != 0) do Str = "File " ++ OutName ++ " seems to be corrupted" messagebox("ok error", Str, "LoadDateTime Script") quit endif DT = vec.create(Rex) if(DT == 0) do messagebox("ok error", "Vector not created", "VEC plugin error") quit endif file.restart(OutFile) for(i = 0; i < Rex; i = i + 1) Str = file.readstring(OutFile) if(Str != 0) DT[i] = Str endfor file.close(OutFile) for(i = 0; i < Counter; i = i + 1) if(pproflag(1)) do Str = line(List, i + 1) else Str = file.readstring(InFile) endif if(Str == OutName) jump Next for(j = 0; j < Rex; j = j + 1) Temp = arg(2) ++ DT[j] if(file.validpath(Temp) == 1 && Temp == Str) do Date = DT[j + 1] Time = DT[j + 2] file.setdate(Str, "c", Date, Time) Date = DT[j + 3] Time = DT[j + 4] file.setdate(Str, "m", Date, Time) break endif endfor @Next endfor file.close(InFile) vec.unload