鲍勃,这太完美了!!!但是。。。有没有办法在每个分组之间添加空格=)这是我的代码。。做了一些调整
- ;;Author: Lee-Mac
- ;;Date: 01/27/10
- ;;Modified By:Commandobill
- ;;Date 04/21/15
- ;;Reason for change: Updated to make text file be in a static position instead of dynamic.
- (defun TimeReac nil
- (vl-load-com)
- (if (not (vl-position "TIMEREACT"
- (mapcar (function strcase)
- (mapcar (function vlr-data)
- (mapcar (function cadr)
- (vlr-reactors :vlr-command-reactor))))))
- (progn
- (vlr-command-reactor "TIMEREACT"
- (list
- (cons :vlr-commandWillStart 'GetTime_C)
- (cons :vlr-commandEnded 'GetTime_O)))
-
- (princ "\n<< Reactor Initiated >>"))
-
- (princ "\n<< Reactor Already Running >>"))
-
- (princ))
- (TimeReac)
- (defun GetTime_O (Reactor Args)
- (if (eq "OPEN" (strcase (car Args)))
- (GetTime))
- (princ))
- (defun GetTime_C (Reactor Args)
- (if (eq "CLOSE" (strcase (car Args)))
- (GetTime))
- (princ))
- (defun GetTime (/ toDate *error* ofile)
-
- (defun toDate (var format)
- (menucmd (strcat "m=$(edtime,$(getvar," var ")," format ")")))
-
- (defun *error* (msg)
- (and ofile (close file))
- (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
- (princ (strcat "\n** Error: " msg " **")))
- (princ))
-
- (if (setq ofile (open "C:\\Users\\Acad2015\\TimeLog\\Logfile.txt" "a"));;Location of change
- (progn
- (if (eq "CLOSE" (strcase (car Args)))
- (write-line "ACTION: CLOSED" ofile)
- (write-line "ACTION: OPENED" ofile))
- (write-line (strcat "DATE: " (toDate "DATE" "MO.DD.YY ** HH.MM.SS")) ofile)
- (write-line (strcat "DRAWING: " (getvar 'DWGPREFIX) (getvar 'DWGNAME)) ofile)
-
-
- (setq ofile (close ofile))))
-
- (princ))
- (defun c:TimeOFF (/ Reac)
- (vl-load-com)
- (if (and (setq Reac
- (car
- (vl-remove-if-not
- (function
- (lambda (x)
- (eq "TIMEREACT" (strcase (vlr-data x)))))
- (mapcar (function cadr)
- (vlr-reactors :vlr-command-reactor)))))
- (vlr-added-p Reac))
- (progn
- (vlr-remove Reac)
- (princ "\n<< Reactor Deactivated >>"))
-
- (princ "\n** Reactor Not Running **"))
-
- (princ))
|