Script for autoflip screen