// for all formal modules 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. Adapted from a script from smartDXL.com */ /****************************************************************************** processDescriptive Do something with the given descriptive module. ******************************************************************************/ void processDescriptive(string mName) { // } /****************************************************************************** processFormal Do something with the given formal module. ******************************************************************************/ void processFormal(string mName) { Module fm fm = read(mName, true, true) //open the module up, displayed and using standard view //set view here for the attributes you want to output //filter for only deleted objects showDeletedObjects true Object o for o in (fm) do { if (isDeleted o) { accept o } else { reject o } } filtering on refresh fm //output the module to a file Column col string sOutFileName = "c:\\temp\\" name(fm) "_delObjs.csv" Stream out = append sOutFileName //if file already exists, just add to it for col in (fm) do //loop through and output column headings { out << title col out << "," //add in comma separator } out << "\n" //output start a new line for o in (fm) do //loop through and output data { for col in (fm) do { if (main col) { if (o."Object Heading" "" == "") { out << o."Object Text" "" out << "," } else { out << o."Object Heading" "" out << "," } } else { out << text(col, o) out << "," } } out << "\n" } close out //done with this module so close it close(fm) } /****************************************************************************** processLink Do something with the given link module. ******************************************************************************/ void processLink(string mName) { // } /****************************************************************************** processFolder Do something with the given folder. ******************************************************************************/ void processFolder(Folder f) { // } /****************************************************************************** processProject Do something with the given project. ******************************************************************************/ void processProject(Project f) { // } /****************************************************************************** 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) { //s = s ("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) print "done"