Start a Program when a Bluetooth Connection is Made?

peti0127

Prominent
Jan 22, 2018
21
0
510
0
Is this somehow possible? I bought a controller and got a program for it that makes it usable as a mouse. I don't want it to start with every windows startup, only when I connect my controller to my PC.
 

gardenman

Reputable
Herald
Hi, this might be possible with a task. The basics:

1. Get info from Device Manager about when device is plugged up.
2. From there view the info in Event Viewer.
3. From there create a Task with that info.

Open Device Manager and right click on the Device and choose Properties. Click on the Events tab and at the bottom click on View All Events. In Event Viewer, find the event where the device was connected and select that event from the list. On the right near the bottom, click on Attach Task To This Event. This will bring up a Task creation wizard. Be sure to give the Task a meaningful name. Follow the steps all the way through.

The Task will now be listed in Task Scheduler and you can modify or delete it from there. For me the event was created under a special folder called "Event Viewer Tasks".

I tried the above and was having problems getting it to work. I wanted Notepad to load when a flash drive was plugged in. It wasn't working, but Notepad would randomly pop up. I knew the event was being triggered, but just not at the right time. So I downloaded [Full Event View] to see what events were being generated when the flash drive was plugged in. I went into Task Scheduler and edited the Trigger to match the Log, Source, and Event ID being shown in the Full Event Viewer and then it worked correctly.

Reference: https://windowsforum.com/threads/windows-task-scheduler-event-on-plug-in-headphone.209697/
 

peti0127

Prominent
Jan 22, 2018
21
0
510
0


So I opened the events of the controlled, but the only information is the installation of the driver 5 days ago and I don't find any event with Full Event View about connecting the controller, only warnings about losing connection.
 

gardenman

Reputable
Herald

Well that's no good. :(

You opened the events of the Controller or the Device? Is the device shown in device manager once it's connected?

My current PC doesn't support Bluetooth so I really can't test it for myself. I had to test a USB flash drive earlier.

Did you run Full Event Log View, connect the device, then refresh it (press F5) to see what all events showed up? It also shows the time which can help you see what all events are being generated.

Can you provide some screen shots of what you are seeing (Device Manager and Full Event Log View for when you connect to the device). To post a screen shot, first take it on your PC and save it to a file. Upload the screen shot to a photo sharing site like https://imgur.com and it will give you a link to post here.
 

peti0127

Prominent
Jan 22, 2018
21
0
510
0


I have no Idea what you mean by device, I checked the events of my controller and Bluetooth Adapter
 

gardenman

Reputable
Herald

Sorry, what I meant by the device is the name of the device that shows up in device manager. For example, "Bluetooth 3.0 mouse" on the following screen shot. I was going to make sure you were going into the properties for your device and not the controller itself.


Can you provide a screen shot of the Full Event Log View showing events that happen when you connect to the device?
 

peti0127

Prominent
Jan 22, 2018
21
0
510
0

This is the log after I (re)connect my controller, I don't see anything Bluetooth related:
https://prnt.sc/khz8a4 (no idea how to post a picture here)

 

gardenman

Reputable
Herald
I'm sorry, I don't know what to tell you. I assumed events would be generated when a connection is made. Experiment around with a Task that is triggered with some of the "Providers" and "Event IDs" that you see in that screen shot and you might hit on one that does happen when you connect. If the "disconnect" event that you mentioned happens *only* shortly after you connect, you could even use that to trigger the program to run. Don't worry so much about what the event says, but WHEN it runs. If it runs shortly after the connection, it can be used to run a program.

I've searched and came up with no additional answers.

Any suggestions from anyone else are welcome.
 

ASK THE COMMUNITY

TRENDING THREADS