How to link a gui slider with a midi controller?

As an alternative, you may want to take a look at a quark that aims to provide this functionality.
(Disclaimer: I made it)