MIDI

You can use Midi devices to provide input to your scripts. This is similar to X-keys functionality and you can use both input types at the same time.

Download the Midi DLL for PowerShell from here  and remember to un-block it (right click on the file and you will see un-block at the bottom of the properties window).

This Midi DLL supports 32bit and 64bit PowerShell hosts and is compiled from this GitHub project https://github.com/imorrish/Windows-10-PowerShell-MIDI

An example of how to use it can be seen in this video

A sample script will shown below