| View previous topic :: View next topic |
| Author |
Message |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Sat Nov 23, 2002 5:09 pm Post subject: file date and time |
|
|
hello i have been playing with the file date and time, it works BUT it only show the current time and date AND NOT when the file was made what i'am trying to do is have it compare the file time and date to the current time and date if its diff then do whatever if not then don't do anything. but first i have to get it to read the file time and date
what i'am doing worng?
thanks
| Code: |
%T = @DATETIME(mm dd yy t ss,)
PARSE "%H;%M;%S"@datetime(hh|mm|ss)
parse "%F;%S;%D",@file(c:\test\test.txt,FTZ)
if @file(%F,%D,%Z,%T)
INFO file time is %T
end
|
|
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Sat Nov 23, 2002 5:37 pm Post subject: |
|
|
I see one problem at a quick glance:
| Code: |
if @file(%F,%D,%Z,%T)
Info File time is %T
end
|
Problem 1:
Your use of the @file() function. Too many commas (",").
This function only allows the use of 1 comma.
Problem 2:
The only information you are returning is the first @datetime() function.
Try returning some of the other variables that you have declared.
Edited code:
| Code: |
%T = @DATETIME(mm dd yy t ss,)
PARSE "%H;%M;%S"@datetime(hh|mm|ss)
parse "%F;%S;%D",@file(c:\test\test.txt,FTZ)
if %F
INFO Current date/time: %T @cr()@cr()C:\Test\Test.txt:@cr()" "Path: %F@cr()" "Size: %D bytes@cr()" "Date/time: @datetime(mm/dd/yyyy tt,%S)
end
|
One other note:
You might want to compare the integer versions of the @datetime() function.
Here's an example:
| Code: |
rem *** Returns the current date and time ***
%T = @datetime()
%S = @file(C:\Test\Test.txt,T)
if @greater(%T,%S)
rem *** Do something ***
else
rem *** Do something else
end
|
_________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it."
Last edited by ShinobiSoft on Sat Nov 23, 2002 5:50 pm; edited 1 time in total |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Sat Nov 23, 2002 5:50 pm Post subject: hummm |
|
|
hummmm
will i try your code and it don't work it shows current time and date BUT not file time and date
and then i get a error in the info statement  |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Sat Nov 23, 2002 5:51 pm Post subject: |
|
|
Sorry Tim:
I noticed an error in my post and was editing it, I think, when you posted a reply. Try it again. _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Sat Nov 23, 2002 7:53 pm Post subject: good new and bads |
|
|
well it shows the file data and time BUT the year it saids is 1900  |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Sat Nov 23, 2002 7:56 pm Post subject: and |
|
|
the date it shows the file is wrong it still saids current date the file was made on 1/22/02  |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Sat Nov 23, 2002 8:35 pm Post subject: |
|
|
I'm not sure why this code is working that way, but it does the same thing on my computer. I even tried the OPTION centurywindow and it didn't work either. It may be a bug in VDS @file() function.  _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Sat Nov 23, 2002 9:00 pm Post subject: |
|
|
Tim,
This works:
| Code: |
info Size: @file(C:\Test\Test.txt,Z)@cr()Date/time: @datetime(mm/dd/yy tt,@file(C:\Test\Test.txt,T))
|  _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Sat Nov 23, 2002 10:28 pm Post subject: ok i got that to |
|
|
ahhh k yup that works question tho this code, no mater what if the file chnages or not it always goes the the second "info2" why what i'am i'am doing wrong? thanks
| Code: |
rem *** Returns the current date and time ***
%T = @DATETIME(mm dd yy t ss,)
%S = @file(C:\Test\Test.txt,T)
if @greater(%T,%S)
rem *** Do something ***
info info1
else
rem *** Do something else
info info2
end
|
|
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sat Nov 23, 2002 10:38 pm Post subject: |
|
|
You're comparing a float to a formatted time.
Use @datetime() for %t.
| Code: |
%T = @DATETIME()
%S = @file(C:\Test\Test.txt,T)
if @greater(%T,%S)
rem *** Do something ***
info info1
else
rem *** Do something else
info info2
end
|
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361

Last edited by Mac on Sat Nov 23, 2002 10:39 pm; edited 1 time in total |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sat Nov 23, 2002 10:38 pm Post subject: |
|
|
Here is the adapted code.
The only problem is that you can't just check if one date is greater then the other, because in this case only the last number makes the difference. You should calculate them all into seconds or something to let it work.
| Code: | rem *** Returns the current date and time ***
%T = @datetime(mm dd yy t ss,)
%S = @datetime(mm dd yy t ss,@file(C:\debug.log,T))
if @greater(%T,%S)
rem *** Do something ***
info info1
else
rem *** Do something else
info info2
end |
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Sat Nov 23, 2002 10:39 pm Post subject: hummmm |
|
|
hummmm i try it that way to then it just goes to info1 even when the file chnages
 |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sat Nov 23, 2002 10:40 pm Post subject: |
|
|
We posted together, check my last post... _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
|