AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Comparing Timestamps

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
TaKeRo
Guest





PostPosted: Thu May 15, 2008 12:01 am    Post subject: Comparing Timestamps Reply with quote

What I'm trying to do is this.
You start the script, letting it sit in the background.
When you are done, you exit, running the subroutine.
The subroutine calculates the number of files that were created while the script was open.
It then adds this value to "Log.txt".
What I'm having trouble with is the comparing of the files' timestamps. I can't get it to work right.
I'm pretty sure it's something simple that I'm missing, but I can't figure it out.

Help?

Code:
#Persistent
FormatTime, StartTime
NumNew = 0
OnExit, ExitSub
return

ExitSub:
DisY := A_ScreenWidth / 2
DisX := A_ScreenHeight / 2
ToolTip, Working..., %DisX%, %DisY%
Loop, C:\*.*,, 1
{
FileTime = %A_LoopFileTimeCreated%
FormatTime, FileTime
FormatTime, SubTime, %StartTime%
EnvSub, SubTime, %FileTime%, S
If SubTime > 0
 NumNew++
}
ToolTip
FormatTime, Day,, MM/dd/yyyy':'
FileAppend, %Day% %NumNew%`n, Log.txt
MsgBox Number of files created today: %NumNew%
ExitApp
Back to top
jaco0646



Joined: 07 Oct 2006
Posts: 523
Location: MN, USA

PostPosted: Thu May 15, 2008 2:34 am    Post subject: Reply with quote

Code:
#Persistent
CoordMode, ToolTip
StartTime := A_Now
NumNew = 0
OnExit, ExitSub
return

ExitSub:
DisY := A_ScreenWidth / 2
DisX := A_ScreenHeight / 2
ToolTip, Working..., %DisX%, %DisY%
Loop, C:\*.*,, 1
 If (A_LoopFileTimeCreated > StartTime)
  NumNew++
ToolTip
FormatTime, Day,, MM/dd/yyyy':'
FileAppend, %Day% %NumNew%`n, Log.txt
MsgBox Number of files created today: %NumNew%
ExitApp

_________________
http://autohotkey.net/~jaco0646/
Back to top
View user's profile Send private message Visit poster's website
TaKeRo
Guest





PostPosted: Thu May 15, 2008 8:38 pm    Post subject: Reply with quote

Still not working. Sad While the code looks much nicer, I'm still getting the same error:

Quote:
Number of files created today: 0
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group