Jump to content

Shortcut to enable/disable bluetooth/gps


ElAguila

Recommended Posts

Does anybody know of a shortcut that can be created that would allow you to enable or disable the Bluetooth and/or the GPS? Or at least a shortcut to bring up the Wireles screen of the PC settings? There are a lot of clicks/touches involved and it would be nice if there was a shortcut to do this.

Link to comment
Share on other sites


Does anybody know of a shortcut that can be created that would allow you to enable or disable the Bluetooth and/or the GPS? Or at least a shortcut to bring up the Wireles screen of the PC settings? There are a lot of clicks/touches involved and it would be nice if there was a shortcut to do this.

I assume by "shortcut" you mean either a batch or .vbs file, anyway you will need to get your hardware id for the device that you want to enable or disable, so

from command line type in: devcon find *> list.txt and that will give you all your IDs then use my example batch or .vbs that I use to toggle my Wi-Fi and revise as needed..Good Luck!

@echo off&color a&mode con: cols=60 lines=4&&title[~ TOGGLE Wi-Fi On/Off ~]
:: DosProbie ö¿ö - 03.13.13
:: Toggle.Device.Voice.cmd
:: NOTE: CHANGE DEV_0083 TO YOUR SPECIFIC HARDWARE ID!
:: To Find ID Run: devcon find *> list.txt

::CK IF ADMIN..
Reg Query "HKU\S-1-5-19" >nul 2>&1 && (
goto startbatch
) || (
echo Right-click file and run as Administrator!
echo.
ping -n 3 yahoo.com>nul 2>&1
goto eof
)
:startbatch
:: DISABLE if Ping successful..
ping -n 1 yahoo.com>nul 2>&1
if %errorlevel% EQU 1 goto enable
devcon disable *DEV_0083>nul 2>&1
cls
echo * WI-FI DISABLED *
set msg=Installation Successful
call :speak "Your device is now disabled!"
:speak
echo On Error Resume Next: CreateObject("SAPI.SpVoice").Speak %1 >"%~dp0vc.vbs"
"%~dp0vc.vbs" & del "%~dp0vc.vbs"
exit

:enable
:: ENABLE Device..
devcon enable *DEV_0083>nul 2>&1
cls
echo * WI-FI ENABLED *
set msg=Installation Successful
call :speak "Your device is now enabled!"
:speak
echo On Error Resume Next: CreateObject("SAPI.SpVoice").Speak %1 >"%~dp0vc.vbs"
"%~dp0vc.vbs" & del "%~dp0vc.vbs"
:eof
exit

' Toggle.Wi-fi.vbs 
' 1st Click toggles off, 2nd Click toggles back on
' DosProbie_2013
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Const TemporaryFolder = 2

Set objshell = wscript.CreateObject("wscript.shell")
Set fso = CreateObject("Scripting.FileSystemObject")

tempfile = fso.GetTempName
path = fso.GetSpecialFolder(TemporaryFolder)
tempfile = path & "\" & tempfile
objShell.run "cmd /c devcon status *DEV_0083 >" & tempfile , 0 ,true
arResults = Split(fso.OpenTextFile(tempfile).ReadAll,vbcrlf)
fso.DeleteFile tempfile
fResults = join(arResults,vbcrlf)
if(InStrRev(fResults, "No matching")) then
Wscript.Quit(0)
elseif(InStrRev(fResults, "running")) then
objShell.run "devcon disable *DEV_0083", 0, true
else
objShell.run "devcon enable *DEV_0083", 0, true
objShell.run "devcon enable *DEV_0083", 0, true
end if

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Edited by DosProbie
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...