 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
TaKeRo Guest
|
Posted: Thu May 15, 2008 12:01 am Post subject: Comparing Timestamps |
|
|
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
|
Posted: Thu May 15, 2008 2:34 am Post subject: |
|
|
| 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 |
|
 |
TaKeRo Guest
|
Posted: Thu May 15, 2008 8:38 pm Post subject: |
|
|
Still not working. While the code looks much nicer, I'm still getting the same error:
| Quote: | | Number of files created today: 0 |
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|