I had both of my computers wiped recently due to various reasons. It meant that i needed to dabble a bit more in EventGhost. I took this time and opportunity to create an EventGhost USB trigger. Primarily, I wanted to open my Sigma Sports software each time my cycling computer is plugged in, regardless of the USB port. YES, I’m really that lazy when it comes to mundane stuff! I rather learn how to do it, and write 500+ tutorial about it, than press Windows key and type in Sigma each time! This will work for any USB device, and you will be able to trigger random things using EventGhost.

EventGhost: USB trigger

Generally, if something takes me more than one try and 2 Google searches, it’s probably worth writing about. If you want to trigger something when a USB device is connected there are a couple of things you have to do.

The benefit of this approach is that regardless of the USB port used, you should be able to recognise the device each time.

You will need 2 macros:

  • USB device connected – identifies the USB device and issues the trigger
  • Device ID – triggers the correct action

USB device trigger

When a USB device is connected to the computer it triggers something like this:

System.DeviceAttached [u'\\\\?\\USB#VID_0483&PID_5740#5&18646f70&0&2#{a5dcbf10-6530-11d2-901f-00c04fb951ed}']

But EventGhost USB trigger that you get moving the event onto the macro is:

System.DeviceAttached

Since we are not able to identify the USB ID directly we can cheat the EventGhost into reading the ID and posting it as a trigger. To do so – select the Python Command Action and use:

eg.TriggerEvent(eg.event.payload[0][8:25], prefix = eg.event.suffix)

Reconnecting the USB device again will produce a new event for us which can be used as USB trigger. This is the EventGhost USB trigger which I’m going to use in the next macro. Note that we have to keep the first macro as well as it will serve as device identification profile.

Device ID

Now that I have the correct event, I can use it to open up Sigma Data Centre software when the Sigma cycling computer is detected. It’s simple enough, there is an action called Run Application. All I have to do is to open the directory of my software and select the .exe file. I can save everything now and next time I connect the cycling computer the EventGhost USB trigger will open the software for me. If you want to add multiple devices, create additional macros for each device, and check the Log for details of newly connected devices.

Conclusion

It’s a simple workaround, but if you have different devices or phones that require particular software to be opened up each time the device is plugged into the system this small hack will save you a couple of seconds. Why not automate it? After all the EvenGhost is constantly running in the background listening to my mobile commands.

Support NotEnoughTech
A lot of time and effort goes into keeping NotEnoughTech alive! If my work helped you out, consider buying me a coffee or check out exclusive rewards available to Patreon supporters.
SHARE