' Name: ViewsKill
'
' Title: Delete all the views containing a certain key
'
' Topics: Views
'
' Description: Delete all the views containing a certain key.
'
' Author: Michael Silberbauer 2001-04-26
' Institute for Water Quality Studies, Department of Water and Sanitation
' Private Bag X313 PRETORIA South Africa 0001
'
'
' Requires: A set of consistently-named views
' Self:
'
' Results:
' -----------------------------------------------------------------------------

theProject = av.GetProject
ViewL = List.Make
DocumentList = theProject.GetDocs
for each anItem in DocumentList
  if (anItem.is(view)) then
    if ((anItem.GetName.AsString.Contains("Pie").Not) and (anItem.GetName.AsString.Contains("Key").Not)) then
      ViewL.Add(anItem)
    end
  end
end
sieve = MsgBox.Input("Enter a view selection string","SIEVE","_pH_")
if (sieve=nil) then
  MsgBox.Info("No views to delete","CANCELLED")
  return nil
end
ViewList = List.Make
for each aView in ViewL
  if (aView.GetName.AsString.Contains(sieve)) then
    ViewList.Add(aView)
  end
end
if (ViewList=nil) then
  MsgBox.Info("No views to delete","CHEAP ROUND!")
  return nil
end
for each nView in ViewList
  myDoc = theProject.FindDoc(nView.AsString)
  'if( ( myDoc <> nil ) and ( MsgBox.YesNo( nView.AsString, "REMOVE?", false ) ) ) then

  if ((myDoc<>nil) and (nView.GetName.AsString.Contains("Key").not)) then
    theProject.RemoveDoc(myDoc)
  end
end