#1 2009-01-10 10:36

Andrew
Senior Member
Registered: 2008-05-22
Posts: 542

PascalScript - FileTimeModified() and FileTimeCreated()

What's wrong with the following PascalScript?

begin
  ShowMessage(DateToStr(FileTimeModified(FileName)));
  ShowMessage(DateToStr(FileTimeCreated(FileName)));
end.

I keep getting "30/12/1899" for every file! Why doesn't this work? sad

Offline

#2 2009-01-11 11:49

krtek
Senior Member
From: Łódź (Poland)
Registered: 2008-02-21
Posts: 262

Re: PascalScript - FileTimeModified() and FileTimeCreated()

I am getting same output. I guess it is a bug...


Regular Expressions are not as hard to understand as you may think. Check ReNamer's manual or nice Regular Expressions tutorial for more info and start to use full power of applications that use them (like ReNamer, Mp3Tag and so on).

Offline

#3 2009-01-11 15:28

Andrew
Senior Member
Registered: 2008-05-22
Posts: 542

Re: PascalScript - FileTimeModified() and FileTimeCreated()

sad Guess Denis needs to look into it then...

Offline

#4 2009-01-13 17:30

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,375

Re: PascalScript - FileTimeModified() and FileTimeCreated()

You must use FILEPATH instead of FILENAME, because FileName is the preview name, while FilePath is the full path to the original file.

P.S. Sorry for delay, just came back from my holidays...

Offline

#5 2009-01-13 18:13

Andrew
Senior Member
Registered: 2008-05-22
Posts: 542

Re: PascalScript - FileTimeModified() and FileTimeCreated()

Yup, seems to work... smile

Offline

#6 2009-01-13 22:44

krtek
Senior Member
From: Łódź (Poland)
Registered: 2008-02-21
Posts: 262

Re: PascalScript - FileTimeModified() and FileTimeCreated()

It would be nice, if you could update user manual.

From: function FileTimeModified(const FileName: WideString): TDateTime;
To: function FileTimeModified(const FilePath: WideString): TDateTime;

Cause that was what made us confused... tongue


Regular Expressions are not as hard to understand as you may think. Check ReNamer's manual or nice Regular Expressions tutorial for more info and start to use full power of applications that use them (like ReNamer, Mp3Tag and so on).

Offline

#7 2009-01-14 08:08

Andrew
Senior Member
Registered: 2008-05-22
Posts: 542

Re: PascalScript - FileTimeModified() and FileTimeCreated()

krtek, that's a very good suggestion. smile

Actually, it might be a good idea if we all contributed short one line descriptions of each PascalScript function to be added to the manual. Some are self-evident by their names, but others might be a bit confusing. Also, for those who haven't ever touched Pascal/Delphi, even common things like how to write different kinds of loops like repeat-until, for etc. is confusing, since not all languages are alike.

Or maybe like the RegEx topic we can have one PascalScript topic with tips and tricks...

Offline

#8 2009-01-20 19:03

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,375

Re: PascalScript - FileTimeModified() and FileTimeCreated()

The FileName parameter is actually named correctly, because it doesn't have to be a full path, it can be a relative path to the current directory. Instead, it is the FileName variable in the PascalScript is badly named by me, because it should really be called Preview or NewName. But now it is too late to rename it, it will break all written scripts.

Offline

Board footer

Powered by FluxBB