This template provides a starting point for a new script where you wish to scan items in a folder, project or database and perform some action according to the items encountered.
Unmodified, this script simply prints the full name of all items found below the current folder.
// for all items in Folder { do something } /* This template provides a starting point for a new script where you wish to scan items in a folder, project or database and perform some action according to the items encountered. Unmodified, this script simply prints the full name of all items found below the current folder. smartDXL.com */ /************************************ processDescriptive Do something with the given descriptive module. ************************************/ void processDescriptive(string mName) { print("Descriptive Module: " mName "\n") } /************************************ processFormal Do something with the given formal module. ************************************/ void processFormal(string mName) { print("Formal Module: " mName "\n") } /************************************ processLink Do something with the given link module. ************************************/ void processLink(string mName) { print("Link Module: " mName "\n") } /************************************ processFolder Do something with the given folder. ************************************/ void processFolder(Folder f) { print("Folder: " fullName(f) "\n") } /************************************ processProject Do something with the given project. ************************************/ void processProject(Project f) { print("Project: " fullName(f) "\n") } /************************************ scanFolder This function scans all items in the given folder, recursing through sub-projects and folders. One of the process functions, defined above, is called according to the type of the item. ************************************/ void scanFolder(Folder f) { Item itm if (null f) { print("NULL Folder parameter passed") return } // loop through items at top level of folder for itm in f do { // sensible checks to avoid run-time errors if (null itm) continue if (isDeleted(itm)) continue // take action according to type of the item if (type (itm) == "Project") { // do something with project processProject(project(itm)) // scan items in the project scanFolder(folder(itm)) } else if (type (itm) == "Folder") { // do something with folder processFolder(folder(itm)) // scan items in the folder scanFolder(folder(itm)) } else if (type (itm) == "Formal") { // do something with formal module processFormal(fullName(itm)) } else if (type (itm) == "Link") { // do something with link module processLink(fullName(itm)) } else if (type (itm) == "Descriptive") { // do something with descriptive module processDescriptive(fullName(itm)) } } } /************************************ MAIN ************************************/ scanFolder(current Folder)