Resource

Resource Basics

Resource Name Sync Write Direct
Resource Version 1.1
Category Catalog
Downloads 1824
Release Date 12/24/2020 11:22:52 AM
 

Resource Details

Description This script will write metadata from catalog to file for selected thumbnails
Installation Instructions 1. Download the script file
Usage Instructions 1. Select one or more files
2. Open Scripter (Tools -> Scripter)
3. Load the downloaded script
4. Run the script
Changes in this version v1.1 Now supports V6.4
v1.0.1; Fixed the progress caption
Special Requirements
 

Author Information

Author Name IDimager Support
 

Script

var
  AOffsetStart, AOffsetEnd, AStart, AEnd, ASum, AAvg: Cardinal;
  i: Integer;
  AImage: TImageItem;
  ACatItem: TCatalogItem;
  APro: TxomProgress;
begin
  if Selected.Count = 0 then
  begin
    Say('Please select at least 1 thumbnail');
    exit;
  end;

  APro := TxomProgress.Create(nil);
  try
    APro.Caption := 'Sync Write Direct';
    APro.Max := Selected.Count;

    AOffsetStart := GetTickCount;
    ASum := 0;
    for i := 0 to Selected.Count - 1 do
    begin
      AImage := Selected.Items[i];

      APro.Pos := i + 1;
      APro.ProgressText := AImage.FileNameOnly;

      AStart := GetTickCount;
      PublicCatalog.SynchronizeToImage(
        AImage,
        PublicOptions.XMPSyncReadSettings,
        PublicOptions.XMPSyncWriteSettings,
        False,
        False,
        scForcedWrite
      );
      AEnd := GetTickCount;

      ASum := ASum + (AEnd - AStart);
    end;
    AOffsetEnd := GetTickCount;
  finally
    APro.Free;
  end;

  AAvg := ASum / Selected.Count;
  Say2(
        'Sync Write for ' + IntToStr(Selected.Count) + ' files',
        'Done in ' +
          FloatToStr(RoundToPrecision((AOffsetEnd - AOffsetStart) / 1000, 2)) + ' sec.' + CrLf +
        'Total time for sync is ' +
          FloatToStr(RoundToPrecision((ASum) / 1000, 2)) + ' sec. ' + CrLf +
        'Average per image is ' +
          FloatToStr(RoundToPrecision((AAvg) / 1000, 2)) + ' sec' + CrLf +
        '');
end;