As a note you're better off trying a script and seeing if you get any errors first rather than asking here, it's hard to identify bugs from a quick glance of a script but if you have an error message it would be easier to identify any potential issues.