Go through this basic example: How to control multiple parameters with a single widget?
And then try Edm11’s script