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.
|
Lista Forumurilor Pe Tematici
|
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login
POZE MRRRR'S FORUM (VIEW ONLY)
Nu sunteti logat.
|
Nou pe simpatie: Profil bellisima19
| Femeie 19 ani Bucuresti cauta Barbat 29 - 43 ani |
|
TRaP
Moderator
Inregistrat: acum 6 ani
Postari: 787
|
|
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:
|
|
pus acum 1 an |
|
Mrrrr
AdMiN
Inregistrat: acum 18 ani
Postari: 2241
|
|
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}" |
_______________________________________
|
|
pus acum 1 an |
|