Have you seen this old tutorial?
If you have function to set the value and variable to read it, you can do what you want.