Jump to content

Logging every files opened


zykl0
 Share

Recommended Posts

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

Link to comment
Share on other sites

#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

Link to comment
Share on other sites

#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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...