Touch Bar script only using alternate color when one character is returned from script

Describe the bug
If I have my AppleScript only return one character, e.g., return "S", and fill in S in Activate alternate color and icon if result matches regex only the alternate settings will be used.

(As an aside, Alternate is misspelled as "Alernate" there :stuck_out_tongue:)

If I return something like "Sp", and enter Sp in "Activate alternate color and icon if result matches regex", alternate settings and primary settings will be swapped as expected based upon the result of the AppleScript.

Affected input device (e.g. MacBook Trackpad, Magic Mouse/Trackpad, Touch Bar, etc.):
Touch Bar

Screenshots
The desired effect is for the button to have a blank background when music is being shown. If I use one character for the result check, the background will always be grey, which is the alternate color.
If I use multiple characters for the result check, the background will change based upon the result.

One char - when result != "S"

Multiple chars - when result != "Sp"

Script

Appearance Settings

Device information:

  • Type of Mac: MacBook Pro (15-inch, 2016)
  • macOS version: 10.13.6
  • BetterTouchTool version: 2.605 (909)

Hi Dafurman,
I am trying to set up almost the same script as yours. I am using the work of vas3k.
I would like to change the icon whether the music is played from Spotify or from Itunes. The main Icon is Spotify and the alternate is Itunes. But I can't find the right place to add the "return" function to get it work.

Spotify icon shown, but music played from Itunes.

Script

Thank you for your help !

Device Information
MacBook Pro (13-inch, 2018)
MacOS 10.14.4
BetterTouchTool 3.202