Hi mcgoo,
Try the attached trigger in Test Mode or Time Machine before attempting to use it live. It pretty much does what you are looking for and you can easily change it according to your specifications.
It was written by one of the moderators, either McBee or Mark so I cannot claim any credit for it, I am just reposting it. I may have altered the original somewhat, but I cannot find the other post so you can have this one at your own risk.
Larp