Streamdeck Button change

I have a specific request regarding the operation of my StreamDeck XL:

I would like the icon of a Stream Deck button to change when a file with a particular name appears in the "downloads" folder (^\d+\$). I've managed to create a routine in KeyboardMaestro where the file name of new files is stored in a variable, and the workflow starts only when the variable name matches the specified one.
Unfortunately, I am not aware of any function in BTT that offers this monitoring feature. However, since my Streamdeck is fully controlled by BTT, I need to pass on this information (the presence of a file with the name ^\d+\$) to BTT and then modify an icon. KMM also has the capability to display a warning on the Streamdeck, which would suffice for my needs.
So it should be possible to achieve the desired behavior, but I seem to lack the necessary skills.
Any assistance would be greatly appreciated.

can you run Apple Script from your KM trigger? If so you could directly set the icon via Apple Script. I can post an example for that.

Folder/File monitoring is also a good idea for a new trigger in BTT. I’ll add that. You could also use the macOS native folder actions (Mac Automation Scripting Guide: Watching Folders)

can you run Apple Script from your KM trigger?


I can post an example for that.

That would be awesome

good idea for a new trigger in BTT. I’ll add that.

Even more awesome

You could also use the macOS native folder action

I've taken a look at this, but I couldn't manage to trigger it only when the file name is correct. My basic scripting skills just aren't up to the task.

Right now only Script Widgets in BTT can be updated externally (this will change soon).

Here is an example that changes the background of the script to red and loads a warning triangle from sf symbols:


tell application "BetterTouchTool"
	update_stream_deck_widget "77DE7331-7880-4E1B-A7A4-BBD5ABE449B8" text "" json "{
      BTTStreamDeckBackgroundColor : '108.194754, 155.000000, 201.000000, 255.000000',
     BTTStreamDeckIconType : 2,
     BTTStreamDeckSFSymbolStyle : 2,
     BTTStreamDeckSFSymbolName : 'exclamationmark.triangle.fill',
     BTTStreamDeckIconColor1 : '255.000000, 224.000002, 97.000002, 255.000000',
     BTTStreamDeckIconColor2 : '100.000000, 45.000001, 33.000002, 255.000000',
     BTTStreamDeckIconColor3 : '100.000000, 45.000001, 33.000002, 255.000000',
end tell

However as mentioned this only works with script widgets. So I'd recommend creating a script widget and just setting the script reload time to a very high value so it won't affect performance:

Also I recommend to use the 4.318 alpha, there was a annoying UI issue with the previous versions where the active tab in Stream Deck config did always reset.


Thank you so much! With your help I pulled it off quite easily and I'm thrilled!
(I'd be stuck in a never-ending rut and wouldn't accomplish anything without your guide.)