ManaUser
Joined: 24 May 2007 Posts: 904
|
Posted: Sat Apr 26, 2008 7:40 pm Post subject: File date lock / internal INI demo |
|
|
This is a very simple script for "locking" file modification dates. Each time the script is run it looks at all the files in the folder. If it has a date saved for that file, it checks if the file still has that date, and if not, changes it back. If it doesn't have a date saved, it saves the current date for next time.
The only other interesting thing about this script is that it uses itself as an INI file, which I thought was kinda cool.
In this case I'm also assuming file names are valid INI keys, which probably isn't completely safe.
| Code: | #SingleInstance Force
#NoEnv
Loop *
{
If (A_LoopFileName != A_ScriptName)
{
IniRead, OldFileTime, %A_ScriptFullPath%, Data, %A_LoopFileName%
FileGetTime CurFileTime, %A_LoopFileName%
If (OldFileTime = "ERROR")
IniWrite %CurFileTime%, %A_ScriptFullPath%, Data, %A_LoopFileName%
ElseIf (CurFileTime != OldFileTime)
FileSetTime OldFileTime, %A_LoopFileName%
}
}
/*
[Data]
; INI data will go here (you can delete this line).
[End]
*/ |
|
|