TimeCapture process

Do AHK libraries work on PC’s with no AHK installed? Test on PCs

I want to try and setup an app that will be extendable.

  1. A basic core program
  2. and then be able to add features of your choosing
  3. write the code in blocks
  4. be able to allow for part of the program to be tested time trial
  5. Plug features in later
  6. Write separate code blocks and compile
  7. Variable interface -corporate or fun
  8. Export options
  9. Web page and help file- Web site?- See Freenom

I’m basically re-looking at the code I have already and re-purposing it.


I’m also trying to extend the methods I’ve used before by setting the code out into smaller blocks for Sub-routines. This has meant that I’m revisiting code I’ve got running to try and 1/ reuse parts of it and 2/ making it more Blocky so that I can manage chunks at a time.

Its sort of working but it takes time to review. I had some problems with Goto instead of GoSub. The To goes, the Sub returns. That took a while to debug after reusing code for a couple of buttons, it working in one but not in the other, mainly because I had no RETURNs so it just kept on going through the script for the first process but broke on the 2nd.

I’m still being mogodored by the syntax and having to spend time testing a short bit of code in a different script, which takes time to setup as I have to setup the variables around it to test it, such as, what files to read & write to and any other environmental issues such as calling classes or other functions


I’m also trying to write a few functions so that I can move them to a separate file to be called by a few scripts.

This has come about after thinking about .dll files. Although the function files are not dynamic (have to be read/loaded into every script ) it is a gathering point of files that are called for a specific purpose in the main code, but are not specific to that code. So trying to generalise them so they may be useful in other programs.

Spending time to revisit code to generalise

So I’ve been spending quite a lot of time thinking about generalising for reuse, also packaging code in a way so that it can be reused further down the script, so chunking it into smaller bits.

This has been:

  • Annoying
  • Difficult
  • Time consuming
  • iterative
  • a learning experience (which takes me back to annoying)
  • Makes me a bit impatient.

Actually, its something Hellbent said about some of his work, he did it once, then re-coded , and the learning he got from that improved the product.

So that was the approach I took with the code today, I was doing the Expenses reporting scripts , after I’d done the Time Reporting scripts, so I was re-visiting the same code doing a slightly different thing.

I decided to look at ways to chunk & make functions in the code, so I could use in the stuff I’d already done and that meant that I had, after getting something more refined working in current code, going back to the older part of the code and re-writing that.

I usually just get something running, and cut/paste/fudge it to work in the new stuff I’m working on, so this is a bit of a mind shift for my coding, although I do see the design iterative process from architecture working here too. Do it once, get something working and then refine it.

That feels like a bit of a step backwards as I’ve resolved an issue that I’d worked on, so going back and re-doing it again is almost like a penalty, rather than a reward.

From the outside , looking at the code as a black box, as long as it works, generally (as in specific cases it can break) then its good enough. If it becomes popular then its worth refining, otherwise, explore an idea and move on.

I think because I’m looking to CHUNK the code so that I can put paywalls up its allowing me to think about code in a slightly different way. Its allowing me to think about efficiencies.

Normally, I’m euphoric if I get a concept to work, so that usually satisfies me, and I move on. This time it means I’ve got to think about the structure a bit more.

Images on Buttons & Timer bar

I’m going back to the timer bar today (Thursday 4 November 2021 ).

I see this as the main display for the program with navigation to other sheets. So I need to link the timers to putting data into the files for time.

So the column width of the program is too long, I need to shorten it by having icons instead of text on the buttons, but I’d like to have info on hover, I need to check up on that.

For getting images onto buttons I’ve found this link to work Images on Buttons?, this is using BMP’s but I want to see if I can use system32.dll icons instead.

I played with MagicBox and found that interesting , but I’d need to learn a whole lot more and I’ll leave it for the moment. MagicBox looks simple but I’m not sdure it is, it seems to be pre-formatted so may not be what I want .

For hunting icons to add I found this site Windows 10 icons. Where are they located? In which files and folders?

Just a comment on that. I didn’t find a good pause icon , 2 vertical bars, so was fudging with refresh icons

Disappearing down a rabbit hole here, thinking about using toolTips on hover over buttons to make it work. Get Tooltips here but script doesn’t like hidden window calls so is not working . So another cul de sac.

I’m going to use Tab Nations process of switches for buttons:

After a little play, its just bloody awkward, the images look a bit ratty . The image is a bit over-scaled but the images look ratty and pixilated, they are just screenshot .jpg’s. They could be redone as .png’s or else I could look at making some .svg’s but at this point I think I’ll leave it as text buttons and revisit it later.

The priority is to get something working first.

So a bit of an unproductive day so far. Or rather, the app hasn’t progressed as far as I’ve liked. I’ve been down many rabbit holes.

The current GUI has a row of buttons at the top to call the other things like reports etc. – this will allow for more timers to be added to the bottom if required in the future.

There is a time Add/Subtract button to tweak time on timer – will have to figure how to adjust that.

So I’ve got to start wiring up some of the buttons now to get some functionality into it.

The pop-up for Notes is so that I can keep all the timer info on one row, so where I need a multi-line Edit box I’ll call that via another Gui and that can save/close

Sat & Sunday wiring up

Things done over the last couple of days

  1. Colour is in INI file so acts across all GUI’s
  2. I’ve wired up a lot of the top buttons so that I’m connected to other scripts
  3. Icon in Top left now clock, using menu, tray, icon, bbb.ico, weird but if fir tray, goes across all guis as well
  4. Linked to Help file web page- so need to do some work on that
  5. There were issues with Timers not working and I was using iniRead/iniwrite clock states to files and that was messing up if/else and stopping clocks
  6. Still running 2 versions of reports, one using a function folder, the other all in one script.
  7. Issue with the reports not closing
  8. Issue with Edit reports in notepad++ as filepath too long (over 125 or 255 digits long) so using notepad.exe to start in folder and run.
  9. Got notes working and persisting in main app.
  10. Got main file writing and adding user and time to input now I can control comma’s in Description field of note.
  11. had issues with letters for keys for timers. when they were numbers on that GUI that blocked those numbers from being used filling out time, so I had to change to letters instead as there is no typing letters in this GUI interface.
  12. Initial persistence for Project for Main Time input – messy but working

I need to:

  1. Be able to get time the same format in Main input & timers
  2. get persistence across timers
  3. be able to add times in new format- maybe use UTC and split/combine for arithmetic
  4. clean up timers – make them less prominent
  5. Be able to send from timers to main clock, there to adjust and then send to file

Once program is in a fit state I can start looking at Blocking off some features behind a License.

Timers playing up

I can’t seem to get the timers to persist. Spent a couple of days messing with them, trying to get the hellbent timer to work. Then looked at timer libraries, now my thoughts are with Functions.

The issue being with A_TickCount , it keeps going up so pausing to get one time , then starting again, the A_TickCount has got much larger, so trying to somehow match it with the stored duration is a bit difficult due to its magnitude. It’s a bit like A_NowUTC , it just carries on going. So it gets a bit messy.

I’m thinking a function that does its tickCount then returns a duration, which you then store, then start another function from scratch, and add the previous pre-set. Since the 2nd call is to a start at 00:00:00 the durations can be added. (It wouldn’t be 00:00:00 , that would be the A_TickCount Formatted to look like H:M:S , which is a tedious exercise on top of being able to store duration persistently.

Just looking at this website, using functions instead of labels. Good example at bottom of SetTimer and also good example of Gui but that does look more complicated. The dude/ess definitely likes functions.

I need to build a function to set A_TickCount and call time and then return a duration.

Duh!!! Finally, on the display line compared my timer to A_TickCount. It was obviouse then that I was adding something to my timer, with Timer:=Timer+Elapsed_Time, so the first timer was a little less than the now elpsed time and then I add the elapsed time onto it so its almost doubling each time, no wonder my timer was going so fast.

That held me back for a couple of days and now I’ve got it running.

A real pain debugging time. This is starting to be a bit of an ordeal. It was supposed to be a demo for licensed part of program. I haven’t even looked at that part yet.

I’ve not got the one or the other, both timers can run simultaneously. Stuff it, they can stay like that for the moment. I’m over working on this part of the code, I’ve really struggled with it and its put a real dent in my confidence.

Wire up timers.

Next part is to wire up the timers so that notes etc can be pushed to main part and then adjusted and put into sheet. Maybe an extra step but I’ll keep it for the moment.

A little bit of reorganising on the GUI and its taken another long while to get the timers and main interface to reset back to start position.

I’ve got something working at the moment. I think I may need to put Save to File Button to the left , its getting lost in the noise of all the other buttons so doesn’t stand as it needs to.

Also getting timer to pause when pushing info to Main Timesheet.

Time Calculations

I think, I need, when sending the Time through to the Sheet that I need to calculate it into a single number like A_TickCount or UTC then that is easier to add/subtract and convert to different format, easier to do arithmetic on single number.

I want them to be able to edit the number and I’m also allowing them to edit the file, so its better to calculate it at the other end so if they change 03:14:00 to 04:17:00 either in the HRS window or in the file later, that it won’t mess up the calculations further down the track.

So this is pushing me to do time calculations at report and output stage , so lots of string manipulation there. It will be easier if the numbers are in the first cell in the report, easier to access.

I should check out how the file looks uploaded into Excel ,to see that the 03:14:00 format works. Seems to be OK. See below:

TimeCapture Main GUI generally operational.

I’ve had to make a couple of adjustments- For re-setting GUI with project to reflect project selected for timers or pushing to Main Timesheet I needed to Choose and so used numbers at front of each project code to find its position in list. Instead of doing a loop to find position. A bit lazy but I wanted this working.

I’ve moved times to front of File so that I can manipulate the strings more easily at the other end.

I suppose this will bugger up my reporting scripts as I think there was a positional thing for time & cost to try and match expenses.

That’s the next exercise. I’m definitely going about this in a really inefficient manner, but that’s just the level of my coding, I’ll get there in the end. (I hope, fingers crossed))

This all came about because I couldn’t save my timers and restart at the position I stopped them.

I suppose this is a design loop and a refinement the 2nd time around.

The code is scattered all over the place and needs re-ordering , but that is for later. Time to charge on and mogadore the next bit, the reports .

Back to Top row of buttons to see if I can get them working.

I’m looking at the Reports code and am struggling to figure it out. Fair enough. I should do a video on what I’ve setup for the main code so I can revit it later. So I did a video, a couple of takes, discussing the main program and issue with timer.

After that I got onto doing the Timer report. As I’d moved time to the front of the row, first column, I needed to review my looping of the files to see it got the correct item to sum.

I then wrote a function that took HH:MM:SS and converted to seconds. I’d already got one from tick(milliseconds) to HH:MM:SS format, so now I could take the time and convert it to seconds, then sum up the seconds in the rows and convert back to HH:MM:SS and show resulting time.

I was pleased with the result.

Then I looked at hourly rates by user and project and decided that it was best in an ini file for lookup, I kept everything in the projectCode.ini file as it all related, I could have split up but for time being keep in one place.

So you have project id & userName from computer, so you can associate user with a Real Name. Also if you look up the project you can get users position on the project, and the position carries a specific hourly rate, so the person may be indifferent positions on different projects and each project may have different hourly rates.

So can find from project and user, their hourly rate to then be used to calculate total time expenditure on that psition in a specific time.

Key1="01 Select PROJECT"
Key2="02 Web Research"
Key3="03 AHK-Programming"
Key4="04 OP-Growhouse Remodel 20210920"
Key5="05 OP-Security&Locker"
Key6="06 OP-Consent2-Redesign"
Key7="07 OP-Consents"
Key8="08 OP-Coordination"
Key9="09 OP-SitePlanning"
Key10="10 OP-General"
Key11="11 OP-Process"

;concept for getting project rates an, user , position to return hourly rate for calculation
;we know user, project
; so need to get position and rate, as position can change on each project, may be lead or technical,
; so need to be able to adjust individual status

;associate userName with personal name 
drake=Mad Mongrel
max=Sane Galumpher

[04 OP-Growhouse Remodel 20210920]

;associate user with ranking for rates per project- 
;look up project first
;then look up user to then find position
;then look up position rates

;user-position on project

;project position rates

[02 Web Research]
;note quotes - are they needed?

;user-position on project

;project position rates

So now we have, at the bottom of report Total Time and That persons total expenditure on the project:

I’m quite pleased with that.

I’m wondering if there is a reverse process where you can put a name in and then get all the info out about a project. A reverse lookup of sorts.

So that part is working, which is quite pleasing, a bit more headway on this. I’m feeling as if the program is starting to be a bit more robust and operable,. a long way to go yet but a nice tailwind today has helped.

FreeCodeCamp Python Api

I was looking at a FreeCodeCamp video on API building in Python, about a social media site, but in fact it could be used for Timesheets . Their one with postgres, python and an api caller. I thought the Python Api FastAPI was interesting – Course Link.

This could be a handy follow on, then you can do timesheet anywhere, and back end database for storing info.

Rates & GST

After you start thinking about results, especially money, you then want to add GST onto it.

Also, I’m wondering about Storing the results in another ini file so you have a synopsis of projects, times, expenses and fees and costs so that you can graph them or do something else with them. It sort of goes on and on, scope creep.

I’ve been at this since the 29th October, so over 2 1/2 weeks. A long time.

Free, try for 30 days & license

Hourly rate- chargeable rate – useful for complete report. then get price- costs? so hours converted to cost- can be charge out rate and what you are paid- can put GST/VAT etc as a pre-set


  • Core timesheet to file
  • one timer


  • Add expenses