Last active
December 16, 2015 17:29
-
-
Save andyhuey/5470950 to your computer and use it in GitHub Desktop.
AX - export all active projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void exportAllProjects() | |
{ | |
// get the project list, and export all projects. | |
Array projects; | |
int i; | |
ProjectNode sharedProjects, privateProjects, projectNode; | |
str myDocsPath, filePath; | |
#WinAPI | |
myDocsPath = WinAPI::getFolderPath(#CSIDL_PERSONAL); | |
myDocsPath += @"\xpo_backup"; | |
// make sure myDocsPath exists. | |
if (!WinAPI::pathExists(myDocsPath)) | |
{ | |
WinAPI::createDirectoryPath(myDocsPath); | |
} | |
projects = this.getProjectList(); | |
sharedProjects = Infolog.projectRootNode().AOTfindChild('Shared'); | |
if (!sharedProjects) | |
throw error("Error: cannot located shared project node!" ); | |
privateProjects = Infolog.projectRootNode().AOTfindChild('Private'); | |
if (!privateProjects) | |
throw error("Error: cannot located private project node!" ); | |
for (i= 1; i <= projects.lastIndex(); i++) | |
{ | |
// skip any line starting with a semi-colon | |
if (subStr (projects.value(i), 1, 1) == ";" ) | |
continue; | |
projectNode = sharedProjects.AOTfindChild(projects.value(i)); | |
if (!ProjectNode) | |
projectNode = privateProjects.AOTfindChild(projects.value(i)); | |
if (projectNode) | |
{ | |
filePath = myDocsPath + @"\" + projects.value(i) + ".xpo" ; | |
projectNode.treeNodeExport(filePath); | |
} | |
else | |
warning(strFmt("Project %1 cannot be found." , projects.value(i))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment