I'm a newbie - a VERY newbie. Am very impressed by ExifTool.
BUT I've got an issue - AND a very crude workaround, which I'd like to improve.
My problem is that the exifdata I want is being corrupted
sometimes with informative text like
"70 directories scanned" and "5500 images processed"
My code is based on Michael Wandel's exifTool wrapper for Visual Basic 6.0 [VBA in Office is very like VB6]
My questionIs there anyone here with enough Windows API knowledge to tell me how to redirect STDERR to a file
OR to buffer it and insert it at the beginning or end of the data stream. I'd rather not simply suppress all error output regardless.
I suspect that my -csv option may be contributory to the problem, but having CSV data sure does simplify the code handling the data
A bit about the wrapperMichael's code as written pipes the results of "
exiftool.exe -s FILE" into the wrapper, where it is presented as an array
Both STDOUT and STDERR are sent to the pipe.
As far as I can tell, there is normally no STDERR output for a successful -s execution, so there is no problem with the code as written.
However if you execute "
exiftool -s FOLDER there IS output on STDERR, typically " 3 folders scanned" and " 20 files processed"
On small volumes this STDERR text comes at the start of the output stream as 2 rows
The trouble is that I fiddled with the code - for good performance reasons
I want to analyse ~100 folders containing ~6000 images and the Excel report includes some metadata timestamps etc.
So I changed Michael's fixed command from
exiftool -s FILE to
exifTool Options, Tags, FileOrFolder which, for example, might expand to:
exifTool -r. -csv -FileModifyDate -FileCreateDate -DateTimeOriginal TOPFOLDERNAME and added code to build a keyed array for each file (row) when it arrives in the wrapper from the exiftool process.
At this point I've finished with exiftool, and with a single execution.
The rest of my Excel code re-processes the same tree extracting the metadata of each image file from the keyed array
and reports fine - given a full set of properly formed rows.
What goes wrong (but only with larger volumes)The File & Folders message text appears in the middle of the exiftool output
I'm sure Hayo Baan had the answer where he says in this thread https://exiftool.org/forum/index.php/topic,5056.msg29215.html#msg29215 (https://exiftool.org/forum/index.php/topic,5056.msg29215.html#msg29215)
QuoteError messgages should go to STDERR and stay separated from the normal output to STDOUT. It looks like your code is mixing the two, and worse seems to have one in buffered mode and another in unbuffered mode, causing the error message to appear somewhere in between the normal output. My guess is, the problem lies somewhere here. It is very very unlikely that it has anything to do with exiftool itself.
That's exactly what is happening.
In Michael's original code I see this
start.hStdOutput = hWritePipe start.hStdError = hWritePipe 'I have changed hWritePipe to NULL, which suppresses the stream
That at least gets me going with the rest of the project
I hope someone can help me build a more elegant solution.
Spilly
Just a quick suggestion: Have you tried contacting Michael Wandel? His email address is in the readme.txt file.
- Phil