There are some solutions of this problem provided by attachment manufacturers.
For example, you can buy by Kaup the system with the special electric cable. It looks and works like spiral spring. You mount it on the mast, connect it to the electric valve on the carriage and let it hang freely. It behaves like a string, extends and shortens with the mast retraction.
The system is relatively cheap, but you must replace the cable pretty often.
Another system is implemented by Auramo. It's a puley with the cable. I think, they may provide you quite good solution.