Productivity Logging

Hi,

I would like to set up a macro that protocols my productivity in a text edit sheet.

When I start my computer KM should write the current Date and when I start my application (Avid Media Composer) it should write ‚Beginning: %time‘

When I make a pause (inactivity longer than 5 minutes it should add ‚Pause start: %time‘ and when I’m back working within Media Composer it should add ‚Pause end:%time‘

At the end of the day when I close Media Composer it should write: ‚End:%time‘

I tried the ‚Application launch‘ and ‚Application quit‘ trigger but somehow it doesn’t work. I also don’t know what trigger to use for the inactivity (‚Pause‘) and activity periods. I just learned that you can really mess things up when using the wrong trigger ('Application running'-trigger)

Also wondering whether I can achieve this in one macro?

Cheers,

Simon

I tried the ‚Application launch‘ and ‚Application quit‘ trigger but somehow it doesn’t work.

OK, here a starter for that:

Log App Start:Quit Times.kmmacros (9.8 KB)


  1. Make sure to have the macro in a group that is always enabled (eg it must not be in a group that is enabled only while Avid is running).
  2. Replace the two application triggers with triggers for the correct app (I used Preview just for easy testing)
  3. The green action, you have to configure (desired path of the protocol document on your volume; no need to create the file). The following Set Variable actions, you can configure them to your likes (format of timestamp etc.)

The red color in the macro is just to mark the core actions.

The macro will create the protocol file (acc. to the path set in the green action), if it does not yet exist.

The text in the protocol file, after a couple of launches/quits, should look like this:

Avid Media Start and End Times:

Beginning: Thu, Dec 1, 2022 6:59:58
End: Thu, Dec 1, 2022 7:00:07
Beginning: Thu, Dec 1, 2022 7:00:10
End: Thu, Dec 1, 2022 7:00:14
Beginning: Thu, Dec 1, 2022 7:04:05

Maybe the most important bit of info for you here is that you can differentiate between the Launch and the Quit trigger by reading the %Trigger% token (since you said those triggers didn't work).
This is done in the 2nd conditional of the macro (the one before the red one).


Now for the other things:

inactivity longer than 5 minutes it should add ‚Pause start: %time‘ and when I’m back working within Media Composer it should add ‚Pause end:%time‘

How do you define 'inactivity' and 'back to working'?

If it's just the app being frontmost, then it can be done via Activates/Deactivates triggers, plus a timer somehow. But I suspect this is not the thing you want…

One could also use the Idle trigger, but this would not account for when you are in another app.

2 Likes

Wow Tom,

Thanks a lot! What an elegant code. I still have a lot to learn about the clever use of variables.

Your assumption is right. I would like to use the Idle trigger. I know this trigger already from an autosave macro I created (also with the help of this forum) but it would be cool if you could tell me how to implement that in your code?

Kind regards,
Simon

I would like to use the Idle trigger.

Try this:

Log App Start:Quit Times [2].kmmacros (19.6 KB)

Macro Image

It should produce something like this:

Avid Media Start and End Times:

End: Tue, Dec 6, 2022 8:23:48
Beginning: Tue, Dec 6, 2022 8:23:51
End: Tue, Dec 6, 2022 8:24:06
Beginning: Tue, Dec 6, 2022 8:24:12
<<< The computer is now idle for 1 minutes: Tue, Dec 6, 2022 8:25:22
>>> The program is activated again: Tue, Dec 6, 2022 8:25:49
End: Tue, Dec 6, 2022 8:26:16
Beginning: Tue, Dec 6, 2022 8:28:56
  • The Idle trigger is ignored if the program has been quit before.
  • The number in the "1 minutes" is read from the %TriggerValue% token, so it should adapt if you change the minutes of the Idle trigger.
  • The "activated again" message comes from the Activates trigger, which is ignored unless the Computer has gone idle before that.

"Activates" means 'becomes the frontmost app'. In order to get an Activates trigger at all (to create the "activated again" message), the program has to be inactive first, but the idle state does not make it inactive. Therefore, when the Idle trigger triggers, the macro activates the Finder (it could as well activate any other program that is not the target program).

So, once you come back to your computer and activate the program, it will log the "activated again" message. (If you left your computer with a different program active, and then come back to that program, the "activated again" message will not be triggered until you really bring the target program to the front again.)

Somehow I think there must be a simpler solution to this, but unfortunately I could not find it…
You know, the kind of solutions that are so obvious it's impossible to see them
:wink:

2 Likes

You're the man. Thanks!

1 Like