forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


file date and time
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
tim6389
Professional Member
Professional Member


Joined: 01 Aug 2002
Posts: 790

PostPosted: Sat Nov 23, 2002 5:09 pm    Post subject: file date and time Reply with quote

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 Sad 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 Sad


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
View user's profile Send private message
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Sat Nov 23, 2002 5:37 pm    Post subject: Reply with quote

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. Cool


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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
tim6389
Professional Member
Professional Member


Joined: 01 Aug 2002
Posts: 790

PostPosted: Sat Nov 23, 2002 5:50 pm    Post subject: hummm Reply with quote

hummmm

will i try your code and it don't work it shows current time and date BUT not file time and date Sad


and then i get a error in the info statement Sad
Back to top
View user's profile Send private message
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Sat Nov 23, 2002 5:51 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
tim6389
Professional Member
Professional Member


Joined: 01 Aug 2002
Posts: 790

PostPosted: Sat Nov 23, 2002 7:53 pm    Post subject: good new and bads Reply with quote

well it shows the file data and time BUT the year it saids is 1900 Sad
Back to top
View user's profile Send private message
tim6389
Professional Member
Professional Member


Joined: 01 Aug 2002
Posts: 790

PostPosted: Sat Nov 23, 2002 7:56 pm    Post subject: and Reply with quote

the date it shows the file is wrong it still saids current date the file was made on 1/22/02 Sad
Back to top
View user's profile Send private message
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Sat Nov 23, 2002 8:35 pm    Post subject: Reply with quote

I'm not sure why this code is working that way, but it does the same thing on my computer. Shocked I even tried the OPTION centurywindow and it didn't work either. It may be a bug in VDS @file() function. Question
_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Sat Nov 23, 2002 8:43 pm    Post subject: Reply with quote

What about this???

Code:
info This file is last editted on @datetime(dddd dd-mmmm-yyyy   hh:nn:ss,@file(c:\debug.log,T))

_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Sat Nov 23, 2002 9:00 pm    Post subject: Reply with quote

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))
Very Happy Very Happy
_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Sat Nov 23, 2002 9:57 pm    Post subject: Reply with quote

That's what I said... Smile
_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
tim6389
Professional Member
Professional Member


Joined: 01 Aug 2002
Posts: 790

PostPosted: Sat Nov 23, 2002 10:28 pm    Post subject: ok i got that to Reply with quote

ahhh k yup that works Smile 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
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sat Nov 23, 2002 10:38 pm    Post subject: Reply with quote

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 Smile

_________________
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
View user's profile Send private message Send e-mail
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Sat Nov 23, 2002 10:38 pm    Post subject: Reply with quote

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
View user's profile Send private message
tim6389
Professional Member
Professional Member


Joined: 01 Aug 2002
Posts: 790

PostPosted: Sat Nov 23, 2002 10:39 pm    Post subject: hummmm Reply with quote

hummmm i try it that way to then it just goes to info1 even when the file chnages

Sad
Back to top
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sat Nov 23, 2002 10:40 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group