If you further need help in developing scripts please raise developer support case we will help you to create tcl script for your requirements.
Just curious, why is that Cisco assumes that people asking on this forum does have a Developer Support contract costing many thousand of dollars per year ? In fact I think almost nobody has one.