avTreeCount = Rows ("Tree");

if (avTreeCount>=1)
{
	choices = {avTreeCount,2};
	for (k=0; k<avTreeCount;k=k+1)
	{
		GetString (tName, Tree, k);
		choices[k][0] = tName;
		choices[k][1] = "Tree "+tName;
	}
	
	ChoiceList (tIndex,"Map branch lengths to parameters for:",1,SKIP_NONE,choices);
	if (tIndex>=0)
	{
		GetString (tName, Tree, tIndex);
		ExecuteCommands ("tree_bl=BranchLength("+tName+",-1);tree_bn=BranchName("+tName+",-1);");
		commands="";
		commands*8192;
		for (k=Columns(tree_bl)-1;k>=0;k=k-1)
		{
			commands*(tName+"."+tree_bn[k]+".synRate=Max(0,"+tree_bl[k]+");\n");
		}
		commands*0;
		ExecuteCommands (commands);
	}
}
