AppleScript Help, File Usage Monitoring

I am trying to make a script of my own that will do the following, however I have not a clue where to begin.

I need it to do:

¢ Record each files name as it is opened, perhaps in an Excel file.
¢ Record the time that it is opened.
¢ Record the time once it is closed.
¢ It would be best to save and close the excel file each time it writes in a new value.

I would want it to put the info in each column, that way I can simply have Excel total up the time per instance that each file was open.

Thanks for any help you can give,

Model: iMac 21.5"
AppleScript: 2.3 (118)
Browser: Camino 2.0.2
Operating System: Mac OS X (10.6)


How many files would this be applicable to?
Do the files reside in the same folder?

That’s an extremely tall order, particularly if you don’t know the names (or locations) of the files in advance.

For a given file F,

do shell script "mdls -name kMDItemUsedDates " & quoted form of POSIX path of F

will tell you dates when a given file was last used (opened), but not durations.

I would argue that duration isn’t going to be of much use anyway. How often have you had a doc open in the background but not really in use?

There’s a rather longer thread about ways to run a script when a file opens.
It might contain something useful.