I have this little Autohotkey script which toggles Bluetooth just fine:
SendMode Input
Run, ms-settings:bluetooth
WinWaitActive, Settings
Sleep 300
Send,{Tab}{Space}
WinClose, A
but I am slightly bothered by the Sleep 300 in there. It seems despite the WinWaitActive the app is not really active and I need to wait for it and I couldn't find anything better than a specified set of time. What would be better to wait for?