Here's the final scripting code I'm using. Based on your reply in Switch Logo with code. I can change the background colour, but the icon isn't recognised or showing?
The Album art is updating in the correct location though. I'm not sure what I'm missing?
{
"BTTWidgetName" : "iTunes Current Track & Cover",
"BTTTriggerType" : 639,
"BTTTriggerTypeDescription" : "Apple Script Widget",
"BTTTriggerClass" : "BTTTriggerTypeTouchBar",
"BTTPredefinedActionType" : -1,
"BTTPredefinedActionName" : "No Action",
"BTTEnabled2" : 1,
"BTTEnabled" : 1,
"BTTOrder" : 7,
"BTTTriggerConfig" : {
"BTTTouchBarItemIconHeight" : 22,
"BTTTouchBarItemIconWidth" : 22,
"BTTTouchBarItemPadding" : 0,
"BTTTouchBarFreeSpaceAfterButton" : "5.000000",
"BTTTouchBarButtonColor" : "75.323769, 75.323769, 75.323769, 255.000000",
"BTTTouchBarAlwaysShowButton" : "0",
"BTTTouchBarAppleScriptString" : "tell application \"System Events\"\r\tset num to count (every process whose name is \"iTunes\")\rend tell\rset maxSize to 20\r\rif num > 0 then\r\t\r\ttell application \"iTunes\" to tell artwork 1 of current track\r\t\tset srcBytes to raw data\r\t\t-- figure out the proper file extension\r\t\tif format is «class PNG » then\r\t\t\tset ext to \".png\"\r\t\telse\r\t\t\tset ext to \".jpg\"\r\t\tend if\r\tend tell\r\t\r\t\r\tset fileName to ((((path to application support folder from user domain) as text) & \"BetterTouchTool:\" as text) & \"itunes_cover\" & ext)\r\t-- write to file\r\tset outFile to open for access file fileName with write permission\r\t-- truncate the file\r\tset eof outFile to 0\r\t-- write the image bytes to the file\r\twrite srcBytes to outFile\r\tclose access outFile\r\t\r\t\r\ttell application \"iTunes\"\r\t\tset playState to (player state as text)\r\t\tif playState is equal to \"playing\" then\r\t\t\tset trackName to name of current track\r\t\t\tset artistName to artist of current track\r\t\t\tset albumName to album of current track\r\t\t\tif length of trackName is greater than maxSize then\r\t\t\t\tset trackName to text 1 thru (maxSize - 3) of trackName & \"...\"\r\t\t\tend if\r\t\t\tif length of artistName is greater than maxSize then\r\t\t\t\tset artistName to text 1 thru (maxSize - 3) of artistName & \"...\"\r\t\t\tend if\r\t\t\tset trackInfo to trackName & \" | \" & artistName\r\t\telse\r\t\t\tset trackInfo to \"\"\r\t\tend if\r\t\treturn \"{\\\"text\\\":\\\"\" & trackInfo & \"\\\",\\\"icon_data\\\": \\\"base64_icon_data\\\", \\\"icon_path\\\":\\\"\" & (POSIX path of fileName as text) & \"\\\", \n\\\"background_color\\\": \\\"255,85,100,255\\\"}\"\r\tend tell\relse\r\tset trackInfo to \"iTunes close\"\r\treturn trackInfo\rend if",
"BTTTouchBarAlternateBackgroundColor" : "128.829533, 128.829533, 128.829533, 255.000000",
"BTTTouchBarScriptUpdateInterval" : 5
}
}