Event Triggers

I use Vitamin R and Keyboard Maestro. In the past I have used Vitamin R's ability to run Applescript on certain events. I have to say, though, I avoid writing Applescript if I can help it :sweat_smile:

Is there a way in Keyboard Maestro to have a general sort of custom events? Kind of like having custom variables. The idea is that I could simply have the Applescript for Vitamin R do something like "tell Keyboard Maestro to notify about event 'Vitamin R Session Started'". Then, instead of having to change the Vitamin R Applescript to choose which KM macros I want to trigger, I can just have KM macros trigger based on a "Vitamin R Session Started" event or a "Vitamin R Session Stopped" event, only needing to ever work inside of the KM UI.

I really like this idea because it separates the two applications and makes it so that they don't really need to know about each other. It might be even better if the events were macOS system events or something so then the Vitamin R applescript wouldn't even need to talk in terms of KM.

I'm pretty sure I could do this with a Shortcut, but I don't want the extra time/window switching.

I've looked at all of the triggers and don't see anything like this (that I understand).

Was just thinking about this some more. Maybe the "KM way" of doing this would be to create a macro called "Vitamin R Session Started" which I trigger from the Vitamin R applescript, and then instead of adding triggers to the other macros, I add the macros as actions to that macro (??).

This is what I've done and it works pretty well :slight_smile:

For more "Don't Repeat Yourself"-ness you can see that I've created a "Open Pomodoro Breaks" macro instead of putting the "Select 'Pomodoro Breaks' in the Menu 'Perspectives' in OmniFocus" action directly in there.