looking for a script that will write certain metadata to a text file
I would like to be able to write certain metadata for each image in a folder to a text file. I would like to see the filename, lens name, f/stop, shutter speed, focal length and ISO for each image.
I was a programmer at one time but that was a long time ago so I asked Gemini to write a Bridge script to access EXIF data. Once that was working I planned to further customze the script output, again with the hhlep of Gemini or Bing AI but it produces an error each time I try to open Bridge with the new script installed. After several rewrites, some of which had the return statement in dfifferent locations, that statement always prodiuced an error. The Javascript iis below:
+++++++++++++++++++++++++++++
function extractEXIFDataToText(folderPath, filename) {
// Build the ExifTool command
var exifToolCmd = "C:\Users\&&&&&\Downloads\exiftool -csv -overwrite_original -quiet " + folderPath + " -Model -CreateDate -ExposureTime -FNumber -ISOSpeed -FocalLength -WhiteBalance -Caption-Abstract -Headline -Description -Keywords >> " + filename;
// Execute the ExifTool command
var result = execute(exifToolCmd);
// Check for errors
if (result != 0) {
alert("Error running ExifTool: " + result);
} else {
alert("EXIF data written to " + filename);
}
}
// Get folder path from user
var folderPath = Folder.selectDialog("Select Folder Containing Images");
if (folderPath == null) {
alert("No folder selected!");
return;
}
// Get output filename from user
var filename = prompt("Enter filename for output text file (e.g., exif_data.txt)");
if (filename == null || filename.length === 0) {
alert("Please enter a filename!");
return;
}
// Call the extractEXIFDataToText function
extractEXIFDataToText(folderPath, filename);
++++++++++++++++++++++++
Bridge complains that the return statement on line 20 is outside the function (or words to that effect).
Can anybody help? Thanks in advance.
