Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
|
Nou pe simpatie: dela_dela pe Simpatie
 | Femeie 24 ani Bucuresti cauta Barbat 24 - 48 ani |
|
|
Mrrrr's Forum (VIEW ONLY)ReguliInregistrareLoginPozeNu sunteti logat. Lista Forumurilor Pe Tematici
|
| #1 |
TRaPModerator
Postari: 960
|
|
Why do I need this, you would ask?
Well, I keep my wireless buds in their case, in a drawer most of the time, but when I open the drawer they move inside the case and connect automatically to the bluetooth of the laptop. Suddenly I have no sound at my laptop and I know why. I have to manually disconnect them every time.
Now I made the following code to do that for me, adapted for Windows 11. You have to adapt it to your system for it to work. You can manually open bluetooth devices, press the TAB key as many times as needed, then edit the code below.
Note: the code works both ways, meaning that if your headphones are disconnected, it will connect them
Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run "ms-settings:bluetooth"
WScript.Sleep 2500
WshShell.SendKeys "{TAB}"
WScript.Sleep 500 WshShell.SendKeys "{TAB}"
WScript.Sleep 500 WshShell.SendKeys "{TAB}"
WScript.Sleep 500 WshShell.SendKeys "{TAB}"
WScript.Sleep 500 WshShell.SendKeys "{TAB}"
WScript.Sleep 500 WshShell.SendKeys "{TAB}"
WScript.Sleep 500 WshShell.SendKeys "{TAB}"
WScript.Sleep 500 WshShell.SendKeys "{DOWN}"
WScript.Sleep 500 WshShell.SendKeys "{TAB}"
WScript.Sleep 500 WshShell.SendKeys "{ENTER}"
' use this for troubleshooting, if needed: ' answer = Msgbox("Are you sure?", vbYesNo) ' If answer = vbNo Then ' WScript.Quit ' End If |
Source: https://superuser.com/questions/1426949 ... oth-device
|
|
| |
|
| #2 |
|
|
On my Windows 10 for example I must use the following script:
Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run "ms-settings:bluetooth"
WScript.Sleep 2500
WshShell.SendKeys "{TAB}"
WScript.Sleep 500 WshShell.SendKeys "{TAB}"
WScript.Sleep 500 WshShell.SendKeys "{TAB}"
WScript.Sleep 500 WshShell.SendKeys "{DOWN}"
WScript.Sleep 500 WshShell.SendKeys "{DOWN}"
WScript.Sleep 500 WshShell.SendKeys "{ENTER}"
WScript.Sleep 500 WshShell.SendKeys "{TAB}"
WScript.Sleep 500 WshShell.SendKeys "{ENTER}" |
_______________________________________

|
|
| |
|