Thursday 4 December 2014

Get list of all Projects in AOT

There's many times when we tend to get the list of all the projects existing in the AOT. This is helpful to keep the development documentation up-to-date. The code below provides an easy list of all the projects and saves them in a csv file.

static void GetProjectNames(Args _args)

{
    #AOT
    #File
    #Properties
   
    TextIo csvIO;
    str description;
    TreeNode projects;
    int total, counter;
  ; 
    csvIO = new TextIo(@"C:\HBProjectsList.xls", #IO_WRITE);
    csvIO.write("Project Name\n");
    projects = TreeNode::findNode(@"\Projects\Shared");
   
    total = projects.AOTchildNodeCount();
    projects = projects.AOTfirstChild();
   
    info(int2str(Total));
   
    for(counter = 1; counter <= total; counter++)
    {
        description += projects.AOTname();
        description += "\n";
        projects = projects.AOTnextSibling();
    }
   
    csvIO.write(description);
}