4

I often tether my laptop through my iPhone to go online when I'm out and about.

Right now I do this manually by looking at the list of available Bluetooth devices and choosing "connect using access point" from the menu bar.

Is there a way to automate this so that my laptop just connects to the phone automatically if there's no regular WiFi present? If it can't be made fully automatic, I'll happily take a script or something similar that at least makes it easier.

1
  • 2
    probably going to want to write a script or AutoHotkey...
    – studiohack
    Commented Jan 16, 2012 at 17:33

2 Answers 2

2

You can bind Win-B to tether Bluetooth.

  1. As suggested by Techie007 you can create a shortcut by going to "Devices and Printers" right-clicking the phone and selecting "Create shortcut".
  2. Put the shortcut in a directory like "C:\Windows\BluetoothLink" by itself
  3. Install Autohotkey
  4. Right click on the Desktop, and choose "New" -> "AutohotkeyScript"
  5. Enter the following:

    #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
    SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
    
    #B::
        SetKeyDelay, 200
        Run, C:\Windows\BluetoothLink
        Sleep, 300
        Send, {Down}
        Sleep, 200
        Send, {AppsKey}
        Sleep, 550
        Send, {Down}
        Send, {Down}
        Send, {Right}
        Send, {Enter}
    
  6. Save the Autohotkey script (e.g. Ctrl-S)

  7. Double click the Autohotkey script to run it
  8. Press Win-B, test that it works
  9. Open your startup directory (e.g. press Win-R and type "shell:startup")
  10. Make a shortcut to the Autohotkey script (so that it works even after reboot).

One could perhaps make this fully automatic by scheduling a task on resume but I am not sure I would recommend fully automatic Autohotkey scripts stealing control of your keyboard from you. They tend to be a bit fiddly even when run manually.

1
  • #B:: SetKeyDelay, 200 Run, C:\Windows\BluetoothLink Sleep, 300 Send, {Down} Sleep, 200 Send, {AppsKey} Send, {Down} Sleep, 200 Send, {AppsKey} Send, {Down} Sleep, 200 Send, {Down} Send, {Right} Send, {Enter} this works, thanks.
    – baskar
    Commented May 28, 2020 at 12:36
1

If you are willing to go the scripting route, then your best bet would be to write something in Windows PowerShell. PowerShell features a powerful scripting language, with numerous cmdlets to allow access to nearly every feature of the OS.

Unfortunately, the script would be highly dependent on the drivers of your wireless card, NIC, and bluetooth card, so there isn't a one-size-fits-all solution.

You'd probably need to first query the status of the wireless network (this thread includes a lot of information on this).

Now, this article might be useful to you for controlling your Bluetooth adapter, but you may be forced to interface with the adapter at the driver level since no standard API exists (outside of Winsock).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .