I imagine it could be done in a script, but would take some time to research how to switch tasks etc from a script/program etc.
I think the biggest problem, would be letting them end properly and not killing the tasks (which can lead to not getting memory back, excess temp files on your HD etc)