0

I have a folder with a bunch of formal modules and I want to know which ones have at least 1 baseline. I started trying something like this:

Item icurr
Folder scr = current Folder
Baseline b = baseline(1, 0, null)

for icurr in scr do
{
   if( baselineExists(icurr, b) )
   {
      print name(icurr)
   }
}

The problem with this code is that baselineExists() only accepts a Module object as first parameter and when I declare icurr to Module instead of Item the for loop this does not recognize any module.

PySerial Killer
  • 428
  • 1
  • 9
  • 26

1 Answers1

0

I think that it easiest to use the for baseline in module loop. Loop through all your items, either with using for item in folder (Items in sub-folders are not included, you will need a recursive function that loops through all found folders) or using for item in project (which will automatically traverse recursively all contained folders and projects). For every item, check if it is a (formal) module using if 'Formal' == type i then {}. If so, get a module variable from the item. Usually, I do this using Module m = read (fullName i, false, true); if !null m then.... Then, when you have opened the module, use code like

Baseline b = null
for b in m do {break} // stop loop at first found baseline
if (!null b) { 
   print "found a baseline in module " fullName(m) ": " major(b) "." minor(b)  " ("suffix(b)")\n"
}

Don't forget to close each module after the evaluation or the script will use a lot of memory

Mike
  • 2,098
  • 1
  • 11
  • 18