{
  Description: This script will remove the full XMP from the selected images
  Author: HB van Zwietering
  Initial date: 2006-12-18
}

var
  ATif: TTif;
  ATag: TTifTag;
  i: Integer;
begin
  if Selected.Count = 0 then
  begin
    Say ('No selection made.');
    exit;
  end;

  if not Ask ('Are you sure you want to remove full XMP for the selected images?') then
    exit;

  Progress.Cancel := False;
  Progress.ProgressBar := True;
  Progress.Max := Selected.Count;
  Progress.Show;

  ATif := TTif.Create (nil);
    for i := 0 to Selected.Count - 1 do
    begin
      Progress.ProgressText := Selected.Items[i].FileName;
      Progress.Pos := i + 1;
      if Progress.Cancel then
        break;

      if not Selected.Items[i].CanUpdateExif then
        Continue;

      // first delete the XMP from the catalog
      Catalog.DeleteXMPForImage (Selected.Items[i]);

      // then remove the XMP from the image itself
      ATif.Reset;
      ATif.FileName := Selected.Items[i].ExifFileName;

      ATif.Load (True, False);

      ATif.RemoveXMP;

      ATif.UpdateTags;
    end;
  ATif.Free;

  Progress.Hide;

  if Progress.Cancel then
    Say ('Cancelled');
end;
