Token Change Monitor Macro (v10.0.2)

I like writing macros that "monitor" things. In this macro I monitor "KM tokens." When a token changes values, this macro notifies me with a display notification. It supports any and all tokens. As built, it runs once every 5 seconds, but that can be changed if you like slower (or faster) notifications. This macro uses a dictionary called Tokens to store the names of the items to monitor and their most recent returned values. If the token changes, the dictionary is updated and I get a notification. It uses a rarely-used filter called "Process Tokens". So if you want to learn about that action, or how to use Dictionaries, this could be a good macro to examine.

If you want to run this, you will need to run the greyed-out initialization group once (just once.) You can modify this list if you want, but if you want to make changes, please note that the percentage marks are "duplicated" for each token because we don't want the tokens processed during the initialization phase.

What is this utility good for? Well, you might want to get notified when your wireless network drops or changes. Or maybe when your Apple Music song changes. I created about a dozen items in my initialization section, but KM provides a few more items if you dig deeper than I did. Also, because you are in control of the notification method, you can send yourself an SMS or iMessage if you want. I wear an Apple Watch, so I could receive these SMS messages when I'm out of the house.

I probably should enhance this macro to support not only tokens, but shell commands also. That wouldn't be too hard, since shell commands don't start with percent characters.

Token Change Monitor Macro (v10.0.2)

Token Change Monitor.kmmacros (11 KB)

2 Likes

This intrigues me… I can probably use this to have my Stream Deck updated with the currently playing song. Thanks for sharing Sleepy!

Great idea. I can see how/why you might want to do that.