Is there any way to exactly duplicate the "preview" mode via a script?