I think next about it:
$NumLayers = pluginmsgex(layers, "NumberOfLayersInWindow", "", INT);
$LayerData = pluginmsgex(layers, "GetLayersInWindow", "", STRING);
pluginmsg(layers, "ReplaceLayersInWindow", "<LayerData>", STRING);
Exist this plugins commands for layers but i don't know if exist this similar commands for tabs.
In menus you can use @TabList to show a list of tabs.
To sort you can send tab list to AutoIt tool to sort it alphabetically and this can return a little temp text file that we can read it in K-Meleon macro to open/move sorted tabs.
K-Meleon in Spanish