Jabra Earpods Quick Connect

Hey guys,

I'm trying to add my Jabra earpods to the touchbar using the following script:


use framework "Foundation"
use framework "IOBluetooth"
use scripting additions

set pairedNames to ((current application's IOBluetoothDevice's pairedDevices())'s valueForKey:"nameOrAddress") as list
set connectedValue to ((current application's IOBluetoothDevice's pairedDevices())'s valueForKey:"connected") as list
set btInfo to {}

set i to 0
repeat with i from 1 to count pairedNames
set btInfo to btInfo & (item i of pairedNames & ", " & item i of connectedValue) as list
end repeat

set i to 0
set deviceConnected to false
repeat with i from 1 to count btInfo
if item i of btInfo contains "Jabra" and item i of btInfo contains ", 1" then
set deviceConnected to true
end if
end repeat

return deviceConnected


However, this is not working. Is there something wrong with the script? Can anyone help me?

Thanks
Alex