Sign in to follow this  
Followers 0
zfisherdrums

Mini File Watcher Utility

1 post in this topic

#1 ·  Posted (edited)

Attached is an application that monitors a specified directory for changes made to files with a specified extension. I'm placing it here in its current state because I have taken so much from the AutoIt community; I need to start giving back.

Included in Zip File

3 Koda Forms

Config.ini

File icon

AU3 script file

Instructions-Lite

The user selects the directory to monitor, a directory to ultimately hold any selected file(s), then uses "Options" to set the file extension to monitor (default is "*.rtf").

When a modified file is detected, it is immediately copied to the user's temp directory with a temp name. Files can then be manually prefixed, copied to the specified directory, or cleared altogether from the ListView. Double clicking the item will bring it up (currently uses the explorer shell). When copying, the app can overwrite any files sharing the same name or rename it with a suffix number to create unique files.

I've used this utility to not only compare differences between files on the fly, but also as a kind of Version Control with scripts I wrote. Any time the file was saved to the monitored directory, the app would create another copy. Soon, I had multiple versions of the same script with the ability to retrieve any one at a click(...well, more like two).

Upon closing the app, all temp files are deleted.

Limitations:

> Sorry, no sub-directories at this time.

> Only 1 file extension is monitored per session (multiple instances could be run as a workaround).

> Virtual-Desktops appear to fire off multiple writes to the desktop. Monitoring the desktop under these conditions can results in a slew of partial temp files.

> More I haven't had time to think of.

Only read the below if you want to know WHY this was made.

The Original Problem:

Software I was testing for my company had experienced a Date format issue between US and Canada. The problem had to do with how MFC interpreted the dates and this led to valuation problems as well incorrect dates in print. Myself and another individual were charged with testing the changes stemming from this bug, paticularly the print changes.

I knew that upon creating a print document, a print component created an RTF document suitable for baselines and regressions. I also knew that AutoIt would come in very handy with automating the tests cases used to produce the print. But I grew tired of always writing code in my scripts to handle retrieving/copying the output files especially when my test cases were changing daily.

The Partial Solution:

The app is called "Mini" because the algorithm used to monitor the directory is probably crude compared to ones used in .NET, Win32, etc. Also, it only monitors 1 specified directory for 1 specified file extension.

I had thrown together an app in .NET to monitor a specified directory for modified files. I abandoned this initial approach for 4 reasons. (1) Company anti-virus software caused multiple triggers of the FileSystemMonitor component (I've since learned a workaround, but oh well). (2) My colleague was using a locked down system, so my .NET 2.0 app would require a Framework she could not obtain without a move of Congress. (3) I'm too lazy to code my GUI's so that SharpDevelop/MSBee could target a .NET 1.1 installation. (4) Coding in AutoIt is more fun for me.

Mini_File_Watcher.zip

Edited by zfisherdrums
1 person likes this

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0