--Bluetooth for VirtualBox --delay 5 set question to display dialog "Manage Bluetooth for ... " buttons {"VirtualBox", "Cancel", "Mac OS"} default button "Cancel" cancel button "Cancel" with icon caution with title "Bluetooth" giving up after 30 set answer to button returned of question if answer is equal to "VirtualBox" then -- delay 30 try do shell script "launchctl unload /System/Library/LaunchDaemons/com.apple.blued.plist" delay 5 end try try do shell script "sudo kextunload -b com.apple.driver.BroadcomUSBBluetoothHCIController" password "secretols" with administrator privileges delay 5 end try try do shell script "sudo kextunload -b com.apple.driver.AppleUSBBluetoothHCIController" password "secretols" with administrator privileges delay 5 end try try do shell script "sudo kextunload -b com.apple.iokit.IOBluetoothSerialManager" password "secretols" with administrator privileges end try else if answer is equal to "Mac OS" then -- delay 30 try do shell script "sudo kextload -b com.apple.iokit.IOBluetoothSerialManager" password "secretols" with administrator privileges delay 5 end try try do shell script "sudo kextload -b com.apple.driver.AppleUSBBluetoothHCIController" password "secretols" with administrator privileges delay 5 end try try do shell script "sudo kextload -b com.apple.driver.BroadcomUSBBluetoothHCIController" password "secretols" with administrator privileges delay 5 end try try do shell script "launchctl load /System/Library/LaunchDaemons/com.apple.blued.plist" end try end if