;====================================================================== ; TrackDwg.LSP ;====================================================================== ; Copyright (C) 2009 All rights reserved by - ; A'cad Solutions ; Alan R. Henderson ; 3642 South Creek Road ; Knoxville, TN 37920 ; 865-579-0047 ; 2009@acadsolutions.biz ;====================================================================== ; Rev.1.0 - 06/14/04 Initial code written from existing program ;====================================================================== ; Program to write line of text each time an AutoCAD drawing is opened ; Date (MM-DD-YY), Time (HH:MM), drawing name and user login name ; Note - this program writes the date and time every drawing is opened ; this program does NOT write when the file is closed ; Log folder location and file name can be changed as required by user ; To run this program each time a drawing is opened - ; copy the contents of this file to the ACADDOC.LSP file ; or add the following line to ACADDOC.LSP ; (load "TrackDwg") ;without the ";" at the beginning ; If you do NOT have an ACADDOC.LSP file - ; save this file as ACADDOC.LSP in an AutoCAD support folder ;the following 4 lines are examples of different folders to save tracking file ;rename the log file or extension as necessary (setq FN "C:/drawings.log") ; file at root level drive C: ;(setq FN "C:/temp/drawings.log") ; file on drive C: in temp folder ;(setq FN "N:/MyFolder/drawings.log") ; file on drive N: in MyFolder folder ;(setq FN (strcat "N:/" (getvar "LOGINNAME") "/drawing.log")) ; if loginname=Alan, file on drive N: in Alan folder ; (use this method to have separate log files by users) ; set date (setq DD (rtos (getvar "CDATE") 2 6) YEAR (substr DD 3 2) MONTH (substr DD 5 2) DAY (substr DD 7 2) HOUR (substr DD 10 2) MINUTE (substr DD 12 2) ) ; set text to write to file - save Date, Time, Drawing Folder, Drawing Name and User Login Name (setq TRACK_TEXT (strcat MONTH "-" DAY "-" YEAR " " HOUR ":" MINUTE " " (getvar "DWGPREFIX") (getvar "DWGNAME") " - user=" (getvar "LOGINNAME")) ; open tracking log file, write information to file and close file (if (setq F0 (open FN "a")) (progn (write-line TRACK_TEXT F0) (close F0) (setq FN nil DD nil YEAR nil MONTH nil DAY nil HOUR nil MINUTE nil TRACK_TEXT nil F0 nil) ) (alert (strcat "\nERROR - " "\n Drawing Log file [" FN "] can NOT be opened." "\n Please check folder location.") ) ) ; the following is the method used to save the keystrokes entered in autocad - ; (setvar "LOGFILEMODE" 1) ;remove ";" at beginning of this line to activate ; when activated AutoCAD records the text window contents in a log file ; the log continues until you exit AutoCAD or use the LOGFILEOFF command ; to set folder where the log files are stored - ; at command prompt type OPTIONS ; pick "Files" tab ; pick "+" at "Log File Location" ; enter drive and folder for log files ; ; Please Note - this is separate from the TrackDwg logging activity (princ)