{ ExifTool Metadata Output will dump all metadata fields identified by the ExifTool program. Version 1.3; Author: IDimager Date: 15 Nov 2022 Added "Save as Text File" Option Version 1.2; Addition of largefilesupport: Petter Flink Date: 4 Feb 2020 Version 1.1; Author: IDimager Date: 28 Aug 2019 Version 1.0; Author: IDimager Date: 15 Apr 2018 This program needs the ExifTool package installed on your machine. This distribution can be downloaded from the web site https://www.sno.phy.queensu.ca/~phil/exiftool ExifTool provides several different distributions. For Windows users, the simplest distribution to install is the satndalone Windows executable zip file. Download it, unzip it, and copy the file exiftool(-k).exe into %LocalAppData%\IDimager Systems, Inc\ExifTool.exe This is the directory that contains the PSU Catalog subdirectory, etc. For Mac users, the simplest thing to do is to download the MacOS Package, which installs the executable exiftool into /usr/local/bin By default, this script searches for the ExifTool executable in the following order: If the registry key 'ExifToolFileName' is set, the script will use the key's value as the location of the ExifTool executable. In the directory . In the standard system directory (C:\Windows on Windows, /usr/local/bin on Mac. The registry key is useful when the ExifTool package has previously been installed into a non-standard system directory. To set the registry key, type and execute the following within Tools>Scripter WriteToRegistry('', 'ExifToolFileName', ); and then restart the program. } var AGrid: TvxStringGrid; AShortFormat: TvxCheckBox; AOut: TStringList; procedure DumpExifTool(ACmd: WideString; AGrid: TvxStringGrid; var row: Integer; ASeparator: Char); var i: Integer; p: Integer; S: String; begin AOut.Clear; RunAppAndWaitForOutput(ACmd, AOut, False); for i := 0 to AOut.Count - 1 do begin S := AOut.Strings[i]; p := Pos(ASeparator, S); if p > 0 then begin AGrid.Cells[0, row] := UTF8Decode(Copy(S, 1, p - 1)); AGrid.Cells[1, row] := UTF8Decode(Copy(S, p + 1, Length(S))) end else AGrid.Cells[0, row] := UTF8Decode(S); Inc(row); end; end; function FindExifTool(var AExecutable: WideString): Boolean; var AFile: WideString; IsWin: Boolean; SysDir: WideString; begin IsWin := IsWindows; if IsWin then begin AFile := 'ExifTool.exe'; SysDir := WindowsDir; end else begin AFile := 'exiftool'; SysDir := '/usr/local/bin/'; end; result := True; AExecutable := ReadFromRegistry('', 'ExifToolFileName', ''); if (AExecutable <> '') and WideFileExists(AExecutable) then exit; AExecutable := DefaultAppDataDir + AFile; if WideFileExists(AExecutable) then exit; AExecutable := SysDir + AFile; if WideFileExists(AExecutable) then exit; Say3('This script requires the executable file ' + AFile + ' in order to display metadata.', 'html:If you have not yet installed the ExifTool package, you can find
installation instructions at ' + 'the online repository.' + '.', 'Please make sure ' + AFile + ' is installed in either ' + DefaultAppDataDir + ' or ' + SysDir + '. ' + 'Alternatively, you can set the registry entry ExifToolFileName to the full pathname of the ExifTool executable.' ); result := False; end; function CheckVersion41: Boolean; var ATokens: TTntStringList; begin result := False; ATokens := TTntStringList.Create; Tokenize(xomProductVersion, '.', ATokens); if ATokens.Count = 4 then begin if (IntToStr(ATokens.Strings[0]) > 4) or ( (IntToStr(ATokens.Strings[0]) = 4) and (IntToStr(ATokens.Strings[1]) >= 1) ) then result := True; end; ATokens.Free; end; procedure PopulateGrid; var row: Integer; ACmd: WideString; AExecutable: WideString; begin AGrid.BeginUpdate; AGrid.RowCount := 0; if not FindExifTool(AExecutable) then exit; row := 0; for i := 0 to Selected.Count - 1 do begin if AShortFormat.IsChecked then begin ACmd := '"' + AExecutable + '" -S -a -g -api largefilesupport=1 "' + Selected.Items[i].ExifFileName + '"'; DumpExifTool(ACmd, AGrid, row, ':'); end else begin ACmd := '"' + AExecutable + '" -a -g -t -api largefilesupport=1 "' + Selected.Items[i].ExifFileName + '"'; DumpExifTool(ACmd, AGrid, row, #9); end; end; AGrid.EndUpdate; end; procedure OnShortFormatChange(Sender: TObject); begin PopulateGrid; end; procedure _SaveToFileClick(Sender: TObject); begin if SaveDialog.Execute then begin AOut.SaveToFile(SaveDialog.FileName); Say('Saved as ' + UTF8Decode(SaveDialog.FileName)); end; end; // MAIN var i: Integer; AForm: TvxSceneForm; ACol: TvxStringColumn; ASettings: TvxLayout; begin if not CheckVersion41 then begin Say('This script requires Photo Supreme 4.1 or higher'); exit; end; if Selected.Count = 0 then begin Say ('No image selected'); exit; end; AOut := TStringList.Create; AForm := TvxSceneForm.Create(nil); if Selected.Count = 1 then AForm.Caption := UTF8Encode(WideFormat('ExifTool Metadata [%s]', [WideExtractFileName(Selected.Items[0].ExifFileName)])) else AForm.Caption := UTF8Encode(IntToStr(Selected.Count) + ' images'); AForm.Width := 520 * AForm.DPIFactor; AForm.Height := Trunc(Screen.Height * 0.6); AForm.BorderStyle := bsSizeable; AGrid := TvxStringGrid.Create(AForm.Root); AForm.Root.AddObject(AGrid); AGrid.Align := vaClient; AGrid.RowCount := 0; ACol := TvxStringColumn.Create(AGrid); ACol.Header := 'Tag'; ACol.Width := 200; AGrid.AddObject(ACol); ACol := TvxStringColumn.Create(AGrid); ACol.Header := 'Value'; ACol.Width := 300; AGrid.AddObject(ACol); ASettings := TvxLayout.Create(AForm.Root); ASettings.Align := vaBottom; ASettings.Height := 50; AForm.Root.AddObject(ASettings); AShortFormat := TvxCheckBox.Create(ASettings); AShortFormat.Text := 'Short tag names'; AShortFormat.IsChecked := False; AShortFormat.Position.Point := vgPoint(5, 5); AShortFormat.OnChange := 'OnShortFormatChange'; ASettings.AddObject(AShortFormat); PopulateGrid; AForm.PrepareModal([mbOK]); AButton := TvxButton.Create(AForm.ModalPanel) AButton.Text := 'Save as text file'; AButton.Align := vaLeft; AButton.Width := 110; AButton.Padding.Rect := vxRect(5, 8, 5, 8); AButton.OnClick := '_SaveToFileClick'; AForm.ModalPanel.AddObject(AButton); AForm.ShowModal; AForm.Free; AOut.Free; end;