My Mac (10.13.2) drives me nuts always hijacking my Bluetooth headset when I want to use it with my iPhone when in another room.
My general idea was to have a macro which sets a global variable BluetoothAllowed = true (or something similar) and run this when I actually want the headset to connect. When somewhere else BluetoothAllowed would be false and I want to run some AppleScript to disconnect from the headset.
It seems, however, that the script is not triggered when a Bluetooth headset is connected. It works for a normal headset with a jack.
Attached a macro just with the trigger and the applescript, which works fine when run manuallySony headset connect:reject.kmmacros (2.1 KB)