When using a DVI connection you can normally hot-swap monitors, delete the old pdf, and rerun the script and it will detect the new monitor. When using VGA and swapping monitors, the script detects the old monitor, unless you restart the computer. (Not sure if you just need to log out and in). Check this.