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 

File date lock / internal INI demo

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
ManaUser



Joined: 24 May 2007
Posts: 904

PostPosted: Sat Apr 26, 2008 7:40 pm    Post subject: File date lock / internal INI demo Reply with quote

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

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]
*/
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions 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