Вам придется перебирать AOT и сравнивать строку с элементами меню.
Этот код взят из примера, приведенного здесь: https://blogs.msdn.microsoft.com/dsiebold/2010/08/13/use-x-to-loop-through-the-aot/
#AOT
//These are the macros for the paths found in #AOT.
//Don't use macros in practice. It's a bad habit.
//#define.MenuItemsDisplayPath('\\Menu Items\\Display')
//#define.MenuItemsOutputPath('\\Menu Items\\Output')
//#define.MenuItemsActionPath('\\Menu Items\\Action')
TreeNode menuItemParentNode;
//str menuItemName = "derp";//output: "derp is not a valid menu item"
str menuItemName = "ActivitiesMain";//output: "ActivitiesMain is a valid menu item"
//Only checking display here, you would need another level of
//nodes to do output and actions.
menuItemParentNode = TreeNode::findNode(#MenuItemsDisplayPath);
if (menuItemParentNode.AOTfindChild(menuItemName))
info(strFmt("%1 is a valid menu item", menuItemName));
else
info(strFmt("%1 is not a valid menu item", menuItemName));