// LoopThroughProject_Test.dxl /* Show looping through the Project */ bool g_DoProject = confirm("[Confirm] to loop through the current Project\n[Cancel] to loop through current Folder") bool g_SubProjects = confirm("[Confirm] to consider sub-projects (if any)\n[Cancel] to ignore sub-projects") bool g_SubFolders = confirm("[Confirm] to consider sub-folders\n[Cancel] to ignore sub-folders") Folder g_fCurr = current if (null g_fCurr){errorBox("Run from open Folder"); halt} // *** HALT *** Project g_pCurr = current if (null g_pCurr and g_DoProject){errorBox("Run from open Project"); halt} // *** HALT *** Folder g_fSource if (g_DoProject) //- then g_fSource = folder(fullName(g_pCurr)) // Source is Project else g_fSource = g_fCurr // Source is Folder //******************************* void RecurseFolder(Folder fld, bool DoSubFolds, DoSubProjs) { // Recurse modules in the folder, optionally sub-folders and sub-project // Function is RECURSIVE enabled. if (null fld) { print "\tRecurse, null folder\n" return } Item itm string NameFold = fullName(fld) string NameItem, TypeItem Folder fldNew // Use Skip list, so items are reported alphebetically, // in the order they appear in the GUI: Skip skpItems = createString() // KEY: 'string' fullName; DATA: 'Item' print ">" (type(fld)) "\t" fullName(fld) "\n" // [0] Stage items in folder in the Skip: for itm in fld do { put(skpItems, fullName(itm), itm) } // [1] Deal with modules directly in this folder: for itm in skpItems do { NameItem = (string key skpItems) TypeItem = type(itm) if (TypeItem == "Formal" or TypeItem == "Link" or TypeItem == "Descriptive") { print TypeItem "\t" NameFold " \t'" name(itm) "'\n" // Deal with the module here. } } // end for items, looking for Modules // [2] Deal with sub-Projects and sub-Folders, if opted to do so: for itm in skpItems do { NameItem = (string key skpItems) TypeItem = type(itm) if ((TypeItem == "Project" and DoSubProjs) or (TypeItem == "Folder" and DoSubFolds) ) { fldNew = folder(itm) RecurseFolder(fldNew, DoSubFolds, DoSubProjs) // *** RECURSION *** } // else print "\t... ignoring " NameItem "\n" } // end for items, looking for Folders and Projects delete(skpItems) } // end RecurseFolder() print "Start, " name(g_fSource) "\t" g_SubFolders "\t" g_SubProjects "\n" RecurseFolder(g_fSource, g_SubFolders, g_SubProjects) // ---- end file LoopThroughProject_Test.dxl ----ile LoopThroughProject_Test.