//
// This macro will do a solve from the current selected item
// and solve all items below it.  It will save between each
// solve and exit at the end.  
//
// NOTE: To exit cleanly be sure that the wbdb is up to 
//       date before solving.
//
//          Revision History
//------------------------------------------
//   dah      11/20/2003    initial checkin
//
//
//

Main();

function Main()
{
	// finds answers, saves, and then exits when done
	
	// block messages so we don't get things like weak spring messages.
	scriptcode.WBScript.Silent = true;

	// reset variable so we can solve more than once.
	scriptcode.prevAnswerObjID = "";

	//get the active branches in the tree and make sure that there is only 1
	var branches = DS.Tree.ActiveBranches;
	var numBranches = branches.Count;
	
	for (i=1; i<=numBranches; i++)
	{
		var branch = branches(i);

		// make active object
		scriptcode.changeActiveObject(branch.AnswerSet.ID);

		// solve
		scriptcode.doSolutionFindAnswers(branch.AnswerSet);

		// save
		scriptcode.doFileSave();

	}
	

	// exit
	scriptcode.doFileExit();
}

