All script code is contained in the demo project:
DOWNLOAD