RUNNAS written by Shawn Tassie one of the Admins of this board and the one who also created KiXforms is probably the best tool for this type of functionality that I'm aware of.

Please read documentation and examples in the original posts as well as the documentation that comes with it and make sure you're running the latest version.