Closed roele closed 3 months ago
Thank you for opening this issue!
🔔 @VladCuciureanu @briankosw @VladCuciureanu @sxn @pernielsentikaer @rspeicher you might want to have a look.
Hey Roland! This is a known issue whose only (somewhat) fix is using the blueutil backend, but you figured that out already. Sadly this is due to the fact that AppleScript is not being maintained properly by Apple and it's unlike I'll have the time to investigate and hack on this further.
The interesting thing is that running the scripts via Automator seems to work fine. So i wonder where it fails exactly... if i find some time and figure out how to debug Raycast extensions, i'll have a closer look.
use framework "IOBluetooth"
use scripting additions
on getFirstMatchingDevice(deviceMacAddress)
repeat with device in (current application's IOBluetoothDevice's pairedDevices() as list)
if (device's addressString as string) contains deviceMacAddress then return device
end repeat
end getFirstMatchingDevice
getFirstMatchingDevice
on disconnectDevice(device)
if (device's isConnected as boolean) then
set result to device's closeConnection()
return result
else
return -1
end if
end disconnectDevice
disconnectDevice(getFirstMatchingDevice("<MAC-ADDR>"))
It would be awesome if you could take a look! It also worked for me inside Automator. A hint would be to look at what blueutil does. They have a hack for this that I've been unable to implement. Something regarding the timing of the instructions or some params passed into a constructor (don't remember as so much time passed since).
@VladCuciureanu Had a quick look and was able to find a workaround which seems to work (at least for me). You can find the PR at https://github.com/VladCuciureanu/Toothpick/pull/5
LGTM! Will merge it upstream as soon as I clone the main repo
Merged!
@raycastbot close this issue.
Extension
https://www.raycast.com/VladCuciureanu/toothpick
Raycast Version
1.73.3
macOS Version
14.5
Description
Device does not disconnect successfully (via AppleScript) after update to macOS 14.5. UI reports
Device disconnected successfully
but device stays connected. This issue does not occur with the experimentalblueutil
backend.Steps To Reproduce
OS: macOS 14.5 Bluetooth Backend: AppleScript
Current Behaviour
Raycast reports
Device disconnected successfully
but device is still connected.Expected Behaviour
Device is disconnected successfully with AppleScript backend.