on doToCards theAction,theCriteria
  toComputer
  ---------------------------------------------------------------------------
  if theAction is "LIST" then
    repeat with x = 1 to the number of cds
      put the short name of cd x into line x of cardsList
    end repeat
    return cardsList
  end if
  ---------------------------------------------------------------------------
  if theAction is "MARK" then
    if theCriteria is empty then
      mark all cds
      return empty
    else
      put markingCriteria(theCriteria) into theCriteria
      do "mark cds where" && theCriteria && "is true"
      doToMarkedCards "list"
      return the result
    end if
  end if
  ---------------------------------------------------------------------------
  if theAction is "UNMARK" then
    if theCriteria is empty then
      unmark all cds
      return empty
    else
      put markingCriteria(theCriteria) into theCriteria
      do "unmark cds where" && theCriteria && "is true"
      doToMarkedCards "list"
      return the result
    end if
  end if
  ---------------------------------------------------------------------------
end doToCards