GoldenChaos-BTT Support and Feedback Thread

Would LOVE to do this, but it doesn't seem possible currently. I think @Andreas_Hegenberg would have to add it to BTT, a few people have requested this so far.

I feel like this should be possible in applescript.

something like this:

  1. make sure the same title is still playing
    check if char-array is empty, if empty then save currently playing into the array
    if not empty then check if the current playing is the same as the array

  2. set the return string and increase a counter
    counter basically says from what index in the array the return string should start
    2.1) if array shorter than desired string length fill with a few empty spaces and then start again from array[0]

What could be problematic is the counter.
I don't have that much experience programming (even less in applescript) and I don't know if a counter could be realised in code.
Of course the counter could be written to a file somewhere, but seems very inefficient to me, plus it probably costs a lot more energy than just having a counter in the ram (not sure about his, just my assumption)

Having some sort of an ability to use a container could be cool. It could be used for scrolling longer text, either new mail subjects, text message replies, or I've been thinking about a daily quote or something?

Hmm, that still didn't fix the calendar for me on Mojave. Strangely, I'm not even getting Output 1 that @Harrumph was getting. I'm stumped.

This works for me for a specific email account within Apple Mail:

tell application "Mail"
set mainaccount to mailbox "INBOX" of account "Work"
set mainunreadvalue to the (unread count) of mainaccount
end tell
return mainunreadvalue

I think it's the quotes in the title. They would need to be \" instead of ", unfortunately Apple Script is really bad at string manipulation.
It would be easy to do with Java Script for Automation, but unfortunately that seems to have a bug and can not save the album cover correctly ;-(

Ahhh, you're definitely right that it's the quotes. I'll look into ways to get around this... on a related note, is there a way to get the widget's icon for display? I would like to use the nice Now Playing Apple Watch icon when iTunes can't provide album artwork.

Currently not (well you could return it as base64 but that's overkill). I'll somehow add that as an option.

1 Like

Okay but let's say I wanted to do that overkill thing how would I go about this :stuck_out_tongue: (it's actually not that big as base64 so I have no problem doing that in the interim)

You can return a json with the base64 encoded image:

"{\"text\":\" \",
\"icon_data\": \"R0lGODlhPQBEAPeoAJosM//AwO/AwHVYZ/z595kzAP/s7P+goOXMv8+fhw/v739/f+8PD98fH/8mJl+fn/9ZWb8/PzWlwv///6wWGbImAPgTEMImIN9gUFCEm/gDALULDN8PAD6atYdCTX9gUNKlj8wZAKUsAOzZz+UMAOsJAP/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JHgxw0xH74yx/3XnaYRJgMB8obxQW6kL9QYEJ0FIFgByfIL7/IQAlvQwEpnAC7DtLNJCKUoO/w45c44GwCXiAFB/OXAATQryUxdN4LfFiwgjCNYg+kYMIEFkCKDs6PKAIJouyGWMS1FSKJOMRB/BoIxYJIUXFUxNwoIkEKPAgCBZSQHQ1A2EWDfDEUVLyADj5AChSIQW6gu10bE/JG2VnCZGfo4R4d0sdQoBAHhPjhIB94v/wRoRKQWGRHgrhGSQJxCS+0pCZbEhAAOw==\", 
\"background_color\": \"255,85,100,255\",
\"font_color\": \"100,200,100,255\",
\"font_size\": 10}"
1 Like

Nice, it worked. Also, this info is useful now that I'm trying to create repeat buttons... apparently you can generate them inside a script? News to me, but that sounds way more efficient than having nine calendar widgets, just generate one for each event happening in the next week.

Yes, you can use the add_new_trigger function (https://docs.bettertouchtool.net/docs/apple_script.html )

1 Like

Try this:

if application "Microsoft Outlook" is running then
try
	tell application "Microsoft Outlook"
		set unreadCount to the (unread count) of inbox
	end tell
	if unreadCount is not 0 then return unreadCount
	if unreadCount is 0 then return ""
on error
	return ""
end try
else
    return ""
end if

I put together some code that might be helpful to add in:

For those using Todoist with a premium account, you have access to some filters via API calls, including what is either due today or over do. Using the API along with the jq tool it is possible to look at at these items and get a count.

Requirements:

  • Obtain your personal API key from your Todoist account in Settings -> Integrations (near the bottom of the page)
  • Install jq (homebrew install jq is my method)

Edit the Due Today item to run a shell script:

curl -L https://beta.todoist.com/API/v8/tasks?filter='('overdue%20|%20today')' -H 'Authorization: Bearer YOUR_API_KEY_HERE' | /usr/local/bin/jq length

You can also set an alternate color to bed red with matching the regex ^0*[1-9][0-9]*$

I'm sure @GoldenChaos can better modify the icons / UI to fit in better :slight_smile:
Hope this is useful!

1 Like

I don't use Todoist personally, but I'll try this out. In general I really want to avoid widgets that require post-install modification, and especially additional helpers, but maybe I'll include it and just keep it disabled by default with instructions in the widget code comments? It seems to be unavoidable for some scripts.

Wondering if this might be of any use for the scrolling text?
https://macscripter.net/viewtopic.php?id=18809

Still getting the same issue? I'm not even sure where the problem lies. Does it need permissions or something?

Sorry @liamb...went to sleep before seeing this. My script was the same as the new Outlook widget script is this morning in 2.555 which is the one that @Randy_Saeks posted.

Here's what I think the problem with multiple accounts and this script is at this time: It will only show the unreadCount of the inbox for the Default account. I have verified this by switching default accounts and then running the script in Script Editor. The good news is it it will show the unreadCount of the default account regardless of account type - e.g. Exchange, IMAP, etc.

I tried to get the unreadCount of the All Accounts Inbox as the easiest solution but I haven't been able to get it to work -. (I suspect the All accounts inbox is actually a generated query - like a smartfolder search; which also didnt work - and not a static folder that can be named in a script successfully.

I think for multiple accounts, the script will have to set and then loop through each inbox by account in order to generate an aggregate total.

@liamb is the inbox unreadCount on your Default account in the settings actually zero by any chance? It will only show the default account inbox value. Try changing the default account in Outlook preferences to see if you get a different result perhaps?

Default Account has unread mail, so not sure what's up?

May be onto something, this seems to kind of work for All Accounts:

tell application "Microsoft Outlook"
if exists (messages where its is read is not true) then
	set countMsg to count (messages where its is read is not true)
	return countMsg
end if
return "No Mail"
end tell

Although when I did it, I got a count of 1001, and counting myself I couldn't get that number. Upon opening 2 messages, it dropped to 999. So it seems to be right, I just can't find what it's actually counting
Based on: