Guidance/Advice Sought re: Making a *simple* Task Log / Time Tracker

Hello everyone!

I have dabbled in making scripts before but it’s been so long I’ve forgotten even most the basics, SO I’m posting here before I even begin because I thought I’d get some advice on tact/direction and viability before I re-learning everything again to avoid putting something together that might not be the best way in the end.

I have looked at the following solution/script a few times before https://macscripter.net/viewtopic.php?pid=180195 but I’m really wary of using it because:

  • Implementing it sounds hard/finicky.
  • The info provided is A LOT to discern and digest.
  • It’s not easy to discern if it is compatible with macOS 10.13 or 10.14 (which I will go to soon).
  • It’s capabilities seem way beyond what I need and the complexities of the code and the historical bugs found make it seem that to rely on it for time keeping I should really know how it works so that I could fix it as-needed or modify it to my changing needs. I have little hope of being able to understand it all in the time I can afford.

So, what follows is my proposed implementation suited to how I want to use it and simple enough for me to understand so that I can fix or modify it as-needed over time.

Desired Workflow

  • I will use Apps on the Dock to activate the automation.
  • There will be one App/script for each task/activity I want to log (my activities are unchanging, generic categories) and one ‘STOP’ App/script to cease the current task. (Yes, so changing activities will require two clicks, which is one click better than my current time tracker app!)
  • Opening an activity app/script will write the following data to the same .txt file:
    Activity Name [and a] START datestamp on a new line, OR
  • Opening the STOP script will put a STOP datestamp at the end of the same(bottom) line.

I realise I could seek to write a script that would automatically put in the STOP datestamp at the end of the line of a ‘live’ activity when a new activity is activated, but I foresee this making the whole thing SO much more complicated. One functionality that I would really like however which is definitely outside my experience is to write this data to the .txt file without it coming to the foreground.

After writing all this I think I’ve now settled on the above design, now I just need to re-learn all the basics of AppleScript and post my proposed script here for others to use or contribute to. I will definitely need advice on how to write this data to the .txt file without bringing TextEdit to the foreground though.

Any comments or input at any stage will be greatly appreciated!

Model: MacBook Pro (15-inch, 2018)
AppleScript: 2.10
Browser: Safari 605.1.15
Operating System: macOS 10.13