Super User Asked by OskeeHelpMe on December 23, 2021
I’m at my wits’ end right now.
I’m on the latest version of Windows 10 and I just want to run a script to connect/disconnect to my Bluetooth headphones when executed. I’ve looked at a couple other posts on the website, namely this one, which all suggested to use this. I actually had it working for a while for about an hour, however, it suddenly starting throwing up System Error 87 after a while (and I hadn’t changed anything, it just stopped working).
Are there any alternative ways to accomplish this or will I just be stuck having to click three extra buttons?
I had this same problem and it looks like there's already a shortcut for it:
Win + A then click Connect
However, one could abbreviate it further by creating a tricky AutoHotkey script to make it all happen with one keystroke.
#SingleInstance, force
CoordMode, Mouse, Screen
^!c:: ; Press Ctrl + Alt + C to start
; You'll need to find your Connect button's Screen coordinates with Window Spy.
connectButtonX = 1120
connectButtonY = 570
; You'll need to find your device entry's Screen coordinates with Window Spy.
deviceEntryX = 1130
deviceEntryY = 240
Send #a ;Win + A
WinWaitActive, ahk_exe Shellexperiencehost.exe,, 5
If ErrorLevel
Return
Sleep, 500
Click %connectButtonX%, %connectButtonY%
WinWaitActive, ahk_exe Shellexperiencehost.exe,, 5
If ErrorLevel
Return
Sleep, 1200
Click %deviceEntryX%, %deviceEntryY%
Send {Escape}
Answered by Brad Turek on December 23, 2021
Try this one: (You'll need Administrative Privilege)
$device = Get-PnpDevice | Where-Object {$_.Class -eq "Bluetooth" -and $_.FriendlyName -eq "FriendlyDeviceName"} Disable-PnpDevice -InstanceId $device.InstanceId -Confirm:$false Start-Sleep -Seconds 10 Enable-PnpDevice -InstanceId >$device.InstanceId -Confirm:$false
NOTE: THIS SCRIPT ISN'T MINE, I TOOK IT FROM HERE.
Additionally, you can use these tools: http://bluetoothinstaller.com/bluetooth-command-line-tools/
Answered by ahmedg on December 23, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP