This will return the DB's ID:
function DBNameToID(%name)
{
%cnt = datablockGroup.getCount();
for(%i=0; %i < %cnt; %i++)
{
%db = datablockGroup.getObject(%i);
if(%db.uiName $= %name)
{
%datablock = %db;
break;
}
}
return %datablock;
}
If you need the datablock name for display purposes, replace return %datablock; with return %datablock.getName();