The following code produces an Excel (CSV) dump of the Ax menu structure. This works with all versions, including 2012.
static void DumpMenuStructure(Args _args)
{
// Dump menu structure to temp CSV file.
TreeNode rootNode;
CommaIo outFile;
str filename;
container line;
void recurseNode(TreeNode node)
{
int childIdx;
TreeNode childNode;
int spacerIdx;
TreeNodeType nodeType = node.treeNodeType();
;
line += node.AOTName();
outFile.write(line);
// Recurse sub-menus
childNode = node.AOTfirstChild();
if(childNode)
{
while(childNode)
{
recurseNode(childNode);
childNode = childNode.AOTnextSibling();
}
}
else
{
// Possible menu reference
childNode = TreeNode::findNode('\\Menus\\' + node.AOTname());
if(childNode)
recurseNode(childNode);
}
line = conDel(line,conLen(line),1);
}
;
filename = WinAPI::getTempFilename(winAPI::getTempPath(),'') + '.csv';
outFile = new CommaIo(filename,'w');
recurseNode(TreeNode::findNode('\\Menus\\MainMenu'));
outFile = null;
WinAPI::shellExecute(filename);
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.