Resource

Resource Basics

Resource Name Recipe Cleansing for Selected Thumbnails
Resource Version 1.0
Category Catalog
Downloads 877
Release Date 5/5/2020 2:09:41 PM
 

Resource Details

Description This script will clean recipes for selected thumbnails
Installation Instructions Download the script file
Usage Instructions 1. Select one or more thumbs to remove the recipe for
2. Select 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: 5 may 2020

    Version history:
        1.0
            5 may 2020;
            initial version
}

  function HandleImageItem(AImageItem: TImageItem): Boolean;
  begin
    result := PublicCatalog.ImageHasRecipe(AImageItem);

    if result then
    begin
      PublicCatalog.RemoveRecipeForImage(AImageItem);
      PublicBroadcastObjectText(nil, 'BuildThumbnailFor', AImageItem, nil, nil, '');
    end;
  end;

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

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

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

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

      if HandleImageItem(Selected.Items[i]) then
        AHit := AHit + 1;
    end;

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