Automating a Menu Bar Icon

I use the Cold Turkey app to schedule blocks where I can't access certain apps / websites so that I can focus. I'd like to automate scheduling those blocks so that they can be part of larger KM workflows, but I can't find a way to do anything with it. It doesn't support AppleScript (AFAIK) so that's out. The main way I was thinking of doing it was via KM's ability to select options from menus. But unfortunately the way of starting these blocks in Cold Turkey is mainly via a menu bar icon, not via the app's menus. Is there a way to select menu bar icons via KM?

I just heard back from the developer about Cold Turkey and there is a way to block apps via the command line:

"/Applications/Cold Turkey Turkey Blocker" -start "Block Name"

But the ability to specify the number of minutes won't be fixed until 4.1. That will look like:

"/Applications/Cold Turkey Turkey Blocker" -start "Block Name" -lock 10

But I'm still curious if it's possible somehow to control menu bar icons with KM

Hi @cheerfulstoic, welcome to the forum.

I have created some macros for you to start your blocks from the menu Iten

Cold Turkey Macros <6412 200907T223717>.kmmacros (341,1 KB)

Please execute the shortcut cmd + ä and then use the first letter or the number at the beginning to start the desired time of the block.

Here is an example:

The last 2 macros are the terminal commands mentioned by the developer. But unfortunately they do not work for me.
I only loaded the app to create the macros. I do not use them myself.

Thanks very much for this! I can see from the Applescript that it selects the menu and then does some manual movements of the arrows keys to go down and over. But that might stop working if I add/remove blocks, right? Is there a way to target items in the menu by name so that it's more robust?

Though honestly I was hoping that KM might have an action (or an extension which adds an action) like "Select or Show a Menu Item" but which works with menu bar icons. If anybody knows of something like that I would love to hear about it

Yes that is correct @cheerfulstoic.

If you add a new block name, you would have to change the first arrow sequence in the AppleScript accordingly.
You could also add key stroke also keycode + name of the block.

A more interesting variant would be the terminal command sent by the developer. But this did not work for me. Does it work for you?

The terminal command works well for me so long as you don't use the -lock option (to specify how long the started block should be locked for). That's the thing that he said would be fixed in 4.1