AppleScript Touch Bar button doesn't work anymore after update.

Hi I updated BTT today to version 3.753 and now some things are not working anymore. I had three TouchBar buttons with apple script behind it, that only shows if a specific app is running. but after the update the buttons are shown always.

How do your Apple Scripts look like? I don't think there has been a change, but maybe I can reproduce when you post the scripts

1 Like

Its a AppleScript / Javascript widget with the following code:

if application "Discord" is running or application "Microsoft Teams" is running then
	return "->"
	return ""
end if

Before the update if one of the two applications was running the button appeared, if none of the applications were running the button disappeared. because of the return "".

Does this still return the correct thing if you run it in the Apple Apple Script editor?

Yes, when I run this in ScriptEditor I get a "->" when one of the app's is running and a "" when none of the apps are running.

Weird, I just tested with some apps here, but it seems to work as expected (hiding when returning "")

However the "is running" has previously caused issues and also takes a lot of performance, which is why I added a BTT function "is_app_running" that can be used like this:

tell application "BetterTouchTool"
	if (is_app_running "Discord") or (is_app_running "Microsoft Teams") then
		return "->"
		return ""
	end if
end tell

Maybe you can quickly check whether it works with that

Thanks for the fast replies!

I tried the code you send, but it wil still not work. I already boot my Mac.
Its like the script isn't running. the checkmark for always running when become visual are on and the execute time is 0 sec.

Weird, you can downgrade to the previous stable version via (create an export of your preset first)

If it’s set to execution time 0, it will only be run once when BTT loads and will not update when you start/quit an app (unless you have it in some group), is that intended? It is possible I fixed an issue where some scripts kept running regularly even though set to 0.

I got it working using a conditional group, otherwise with only AppleScript at one button it simply doesn't work anymore after yesterday update.

The only button I can't transform to a conditional group is my AirPods controller, maybe a new future for a next update check connected Bluetooth status from AirPods so you can make a conditional group for that.

this is de script I always used:

use framework "IOBluetooth"
use scripting additions

on isDeviceConnected(substring)
	repeat with device in (current application's IOBluetoothDevice's pairedDevices() as list)
		if device's isConnected and (device's nameOrAddress as string) contains substring then return 1
	end repeat
	return 0
end isDeviceConnected

if isDeviceConnected("ARIPODSNAME") is 1 then
	return "Connected"
	return ""
end if

It really should still work. Could you go to Help => Export Diagnostic Debug Information and send the result to me? (

This would break tons of presets if it wouldn't work anymore, thus I'd like to check what's wrong (however there haven't been other related bug reports, so currently I assume it must be something very specific to your setup)

Did you try to change from refreshing the widget never (repeat interval 0) to running it in repeated intervals? I think that might be the only thing that was fixed in one of the previous builds

1 Like

Yes, I tried to change the repeat interval and it still not work, the button keeps showing.

I wil send you de email with a ZIP of the files in Export Diagnostic Debug Information

I Have fixed the problem. I created a new button with exact the same script and settings. The new button works how It used to work, so I deleted the "old" and now using the new one! Thanks for your help!