Jump to content

Time log


fcfcadd

Recommended Posts

I am looking for a program in either lisp or vba to keep track of time. I have seen the "Drawing Log" post put up by "russell84" and the response by "borgunit" but neither of them keep track of the total time spent within that file. They just post the user, date with time opened, and the file. I need one that posts the time spent or end time as well. In other words I want to know how long I spent in each drawing file if it was 1 second or 8 hours. I'd like the format to be:

 

USER | DATE AND TIME OPENED | DATE AND TIME CLOSED | TOTAL AMOUNT OF TIME | FILE.

 

Can this be done is the other question.

Link to comment
Share on other sites

  • Replies 92
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    21

  • alanjt

    16

  • fcfcadd

    14

  • The Buzzard

    13

Top Posters In This Topic

Posted Images

What happens if you open a drawing, walk away for 4 hours and then return? Should that count for 4 hours? If not, how would you proposed "time spent" be accounted for?

Link to comment
Share on other sites

For me it doesn't matter if I walk away for 4 hours or not or if I'm sitting there actually working on it. Personally for my situation if I'm done with a drawing then I close it. I don't leave AutoCAD opened if I'm not in it using it.

 

No I have not tried TIME command. I have only tried the lisp program that was posted on that other thread.

Link to comment
Share on other sites

I use a good old-fashioned notebook, because like RK said, there is no way that a time-log would accuratly describe exactly how many hours you have worked on a drawing. Did you close AutoCAD down when you wrote this thread? When you talk to you co-workers? When you get a cup of coffe? bathroom break? I get that it's good to know a ballpark figure on how many hours a drawing takes, and again - a notebook is accurate enough in my opinion.

Link to comment
Share on other sites

Agree with Tiger...

 

Having said that.... http://www.autojournal.net/ used to host an old program in VBA that wrote out data to Outlook. I don't know what criteria it used to determine the time, other than how long the drawing was open. Currently my firewall is blocking this URL so it may have changed to something else....?

Link to comment
Share on other sites

Yes I did close out of AutoCAD when typing this. Like I said before when I'm not working in AutoCAD I close it down. I am self employeed so keeping accurate time is very important to me and when you switch between 5 or 10 jobs a day the notebook option is a pain in the but. That's why I would rather have something electronicly track the time spent. I'll check into the autojournal option as well.

Link to comment
Share on other sites

How do I use that to have it automatically log the time to a file. Is there a program that does that?

 

The values that the TIME command uses are stored in the Sys Vars: TDINDWG, TDCREATE, TDUPDATE, TDUSRTIMER

 

A simple LISP could write these values to a file.

Link to comment
Share on other sites

It's been over ten years since I've wrote a lisp routine. I wouldn't know how to put it together. Basicly I'm asking if someone could put a simple one together for me in either lisp or vba.

Link to comment
Share on other sites

Example:

 

(defun c: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 (or *logfile* (setq *logfile* (getfiled "Create Log File" "" "txt" 1)))
   (progn
     (setq ofile (open *logfile* "a"))

     (write-line (strcat "DATE: " (toDate "DATE" "DD.MO.YY HH.MM.SS"))              ofile)
     (write-line (strcat "DRAWING: " (getvar 'DWGPREFIX) (getvar 'DWGNAME))         ofile)
     (write-line (strcat "CREATED: " (toDate "TDCREATE" "DD.MO.YY HH.MM.SS"))       ofile)
     (write-line (strcat "TOTAL EDITING TIME: " (toDate "TDINDWG" "HH.MM.SS") "\n") ofile)

     (setq ofile (close ofile))))

 (princ))

     

Link to comment
Share on other sites

I'll give that a try and see if I can get it to run automaticlly. Thank you so much.

 

When you say automatically, what do you mean? When the drawing is saved? If you want it to run automatically, you will need to maybe use it as a callback function in a reactor, triggered on the save command.

Link to comment
Share on other sites

I would need it to run on the open command and on the close command. So each time i opened a new drawing and then when I closed that drawing. Even if I had to answer a prompt at close for it to run would be fine too.

Link to comment
Share on other sites

Yeah I've been on that web site before and he used to have a vba program that kept track of time on there as well but It has some bugs in it right now and I can't get it to work right.

Link to comment
Share on other sites

This should work for you:

 

(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 (strcat (getvar 'DWGPREFIX) (getvar 'DWGNAME) "_log.txt") "a"))
   (progn     

     (write-line (strcat "DATE: "    (toDate "DATE" "DD.MO.YY HH.MM.SS"))           ofile)
     (write-line (strcat "DRAWING: " (getvar 'DWGPREFIX) (getvar 'DWGNAME))         ofile)
     (write-line (strcat "CREATED: " (toDate "TDCREATE" "DD.MO.YY HH.MM.SS"))       ofile)
     (write-line (strcat "TOTAL EDITING TIME: " (toDate "TDINDWG" "HH.MM.SS") "\n") 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))
       

 

Place the code into your ACADDOC.lsp, so that it runs when you open the drawing.

 

You can enter TIMEOFF to disengage the reactor at any time.

 

Lee

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...