Resource

Resource Basics

Resource Name Delete all Areas for Selected
Resource Version 1.0
Category Catalog
Downloads 997
Release Date 4/28/2020 9:12:33 AM
 

Resource Details

Description This script removes all Areas for the selected thumbnails from the Catalog
Installation Instructions Download the file to your hard drive
Usage Instructions 1. Select the thumbnails to remove the areas for
2. Start Tools->Scripter
3. Load the downloaded script
4. Run the script
Changes in this version n.a.
Special Requirements
 

Author Information

Author Name IDimager Support
 

Script

{
    Author: IDimager
    Initial Date: 28 apr 2020

    Version history:
        1.0 
            28 apr 2020; 
            initial version
}

  function HandleImageItem(AImageItem: TImageItem): Boolean;
  begin
    result := PublicCatalog.DeleteAreasForImage(AImageItem, False, False, False);
  end;

var
  i: Integer;
  AProgress: TxomProgress;
begin
  if Selected.Count = 0 then
  begin
    Say ('No images selected');
    exit;
  end;

  if not Ask ('This script will delete all Areas for the ' + IntToStr(Selected.Count) + ' selected thumbnails.' + CrLf2 + 'Are you sure you want to continue?') then
    exit;

  AProgress := TxomProgress.Create(nil);
  try
    AProgress.Caption := 'Delete all areas';
    AProgress.Cancel := False;
    AProgress.ProgressBar := True;
    AProgress.Max := Selected.Count;
    AProgress.Show;

    for i := 0 to Selected.Count - 1 do
    begin
      AProgress.ProgressText := Selected.Items[i].FileName;
      AProgress.Pos := i + 1;
      if AProgress.Cancel then
        break;

      HandleImageItem(Selected.Items[i]);
    end;

    AProgress.Hide;
    if AProgress.Cancel then
      Say('Cancelled')
    else
      Say('Done');
  finally
    AProgress.Free;
  end;
end;