Jump to content
Sign in to follow this  
zykl0

Logging every files opened

Recommended Posts

zykl0

Hello!

At job we need to fil up an excel sheet every week with every project we worked on.

The major problem is half of people doesnt remember what project they worked on 2 day ago.

For a better accurancy i would like to create a script that run 24/24 and monitor in a .log every file opened/closed

something similar as this.

09/01/15 8:00am: Open "C:\Program Files\AutoCAD 2007\acad.exe"

09/01/15 8:02am: Open "T:\Project 2009\0922 project x\ground.floor.dwg"

09/01/15 2:00pm: Open "T:\Project 2009\0922 project x\fax.xls"

09/01/15 2:05pm: Close "T:\Project 2009\0922 project x\fax.xls"

09/01/15 4:00pm: Close "T:\Project 2009\0922 project x\ground.floor.dwg"

Someone know how to do this?

I am not qualified enough to write this, i have searched around on net but i cant find something that fit my need and are Free !

thank you

Share this post


Link to post
Share on other sites
Inverted

As a starting suggestion, you should look in the registry. I'm sure Excel drops more than enough info and file history there :-)

For example, doesn't it save the most recent files opened in the registry ?

Edited by Inverted

Share this post


Link to post
Share on other sites
Authenticity

#include <File.au3>
Opt('MustDeclareVars', 1)

Dim $Path = @MyDocumentsDir & '\..\Recent'
Dim $Arr, $sHeader, $sDate, $i

$sDate = @MON & '/' & @MDAY & '/' & @YEAR & @TAB & @HOUR & ':' & @MIN & ':' & @SEC 

$sHeader = @CRLF & @CRLF & '****************************************************************' & @CRLF & _
                          '  Current date "Recent" folder content: (' & $sDate & ')' & @CRLF & _
                          '****************************************************************' & @CRLF
                
If FileExists($Path) Then
    Local $hFile = FileOpen('C:\DailyLog.log', 1)
        If @error Then
            ConsoleWrite('Could not open file' & @CRLF)
            Exit
        EndIf
        
    FileWrite($hFile, $sHeader)
    $Arr = _FileListToArray($Path, '*')
    
    For $i = 1 To $Arr[0]
        FileWriteLine($hFile, StringTrimRight($Arr[$i], 4))
    Next
    
    FileClose($hFile)
Else
    MsgBox(0x10, 'Title', 'Descriptive Error', 5)
EndIf

Share this post


Link to post
Share on other sites
zykl0

#include <File.au3>
Opt('MustDeclareVars', 1)

Dim $Path = @MyDocumentsDir & '\..\Recent'
Dim $Arr, $sHeader, $sDate, $i

$sDate = @MON & '/' & @MDAY & '/' & @YEAR & @TAB & @HOUR & ':' & @MIN & ':' & @SEC 

$sHeader = @CRLF & @CRLF & '****************************************************************' & @CRLF & _
                          '  Current date "Recent" folder content: (' & $sDate & ')' & @CRLF & _
                          '****************************************************************' & @CRLF
                
If FileExists($Path) Then
    Local $hFile = FileOpen('C:\DailyLog.log', 1)
        If @error Then
            ConsoleWrite('Could not open file' & @CRLF)
            Exit
        EndIf
        
    FileWrite($hFile, $sHeader)
    $Arr = _FileListToArray($Path, '*')
    
    For $i = 1 To $Arr[0]
        FileWriteLine($hFile, StringTrimRight($Arr[$i], 4))
    Next
    
    FileClose($hFile)
Else
    MsgBox(0x10, 'Title', 'Descriptive Error', 5)
EndIf
Do i need a file called #include <File.au3> ?

Because it generate a list without date/hour sample, and from MONTHS ago! this is huge!

eg:

$28952-702-703-704

$28952-707

$28952-708-709-1

$28952-N13

00-Borderaux de transmission

00-Fax

001-Page couverture (Fiches Technique).doc

002-Table des matières.doc

01-Résultat hydraulique

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  

×