- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
File time counter
Hi,
is it possible to create a Logic which, when started, would show how much time in total (I mean closing and reopening) was spent working on that file?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Here is a simple Stopwatch example. It uses the System.Diagnostics.Stopwatch Class. It is often used to gauge elapsed time differences between different versions of the same code/application for efficiency purposes. Maybe you can use this object to achieve your goal.
Dim oTimer As New Stopwatch
oTimer.Start
'Do some stuff here
Dim i As Long
Dim oCode As Long
'simply gives it something to do a bunch of times for the example
'should only take a few seconds
For i = 1 To 1000000
oCode = ThisApplication.Locale
Next
oTimer.Stop
'This one is more specific (shows 3 decimal places after seconds)
MsgBox("Elapsed time = " & oTimer.ElapsedMilliseconds / 1000 & " seconds", vbOKOnly, " ")
'or this one doesn't have any decimal places
'MsgBox("Elapsed time = " & oTimer.Elapsed.Seconds & " seconds",vbOKOnly," ") If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE'
.
If you have time, please... Vote For My IDEAS
and Explore My CONTRIBUTIONS
Inventor 2021 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum
Wesley Crihfield
(Not an Autodesk Employee)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Here is another simple 'Timer' example rule, which uses a different method.
Dim oStart, oFinish, oTotal As Double
MsgBox("Click 'OK' to start the timer.",,"")
oStart = Microsoft.VisualBasic.DateAndTime.Timer
MsgBox("Click 'STOP' to stop the timer.",,"")
oFinish = Microsoft.VisualBasic.DateAndTime.Timer
oTotal = oFinish - oStart
MsgBox(oTotal & " seconds have elapsed.",,"")
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE'
.
Wesley Crihfield
(Not an Autodesk Employee)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Check out the below link on @Anonymous Unofficial Inventor blog, which is explaining the same thing you are trying to achieve.
https://clintbrown.co.uk/2020/12/12/ilogic-file-open-timer/
Hope this will be helpful.
Regards,
Dutt Thakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
thanks but i didn't mean that. I work on multiple projects at the same time. I would like to know how much time I have worked on a project without having to write down the time on paper
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
OK. I think I understand now. I'm thinking you might need something like an Addon or a standalone app to accomplish that, instead of iLogic rules or VBA macros. You need something that will automatically activate in the background, no mater what documents you may be opening, working with, or closing, and stay active in the background until all documents (or the application) are closed, then it will automatically stop and write elapsed time data to a static file on your hard drive, which can later be accessed and multiple session times summed up to a total project time. Sounds like it may be doable though. Unfortunately I may not be a lot of help there, because our company doesn't currently allow any employees Admin rights on their own PC's, so creating Addins is not possible for me at this time.
The closest non-addin solution I can think of right now would be something like the following:
An external iLogic rule that is set-up within your Event Triggers dialog, under the "All Documents" tab, under "New Document", "After Open Document", and "Close Document", so it will be fired by all these events. Then at the top of your rule, to avoid unnecessary runs/processes, have some code that checks (for when Open has triggered it) if any other documents are already open. If no other docs are open, write this event start time to file. If other docs are already open, your still working, so ignore it and exit the rule. Also, at the top as a check (for when Close has triggered it), see if any docs are left open. If no docs are open, it just closed the last one, so write this finish time to file. Then later in the rule, you can have some code to retrieve and sum up (calculate) all current entries within that data file (likely Excel file), and offer an option to display it. At least that's what's rolling around in my head. Does that make sense to you?
I hope this helps in some way.
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE'
.
Wesley Crihfield
(Not an Autodesk Employee)