var ALabelCount: Integer; function Initialize: Boolean; var ALabels: String; begin // return false to cancel the filter operation result := False; ALabelCount := ReadFromRegistry('FilterWithXLabels', 'LabelCount', 1); ALabels := IntToStr(ALabelCount); if AskInput('Label Count', 'How many labels should be assigned?', '', ALabels, False, nil) then begin if not IsValidNumberString(ALabels, False, '') then Say('Please enter a valid number') else begin ALabelCount := Trunc(StrToFLoat(ALabels)); WriteToRegistry('FilterWithXLabels', 'LabelCount', ALabelCount); result := True; end; end; end; procedure Finalize; begin end; function Filter(AItem: TImageItem): Boolean; begin AItem.Fetch; result := AItem._PropCount = ALabelCount; //result := Catalog.CountPropsForImage(AItem, False) = 1; end;