Call ExifTool from Excel with the Shell function

Started by Olof, September 06, 2013, 07:44:55 AM

Previous topic - Next topic

Olof

Hi,
I am a newbee to ExifTool. I can't get the same result when I copy and paste to the C:\> prompt as when I call the Command line from a Excel macro with the Shell function.

What I want to do is like this:
"C:\...\Exif-Tool\exiftool" -t -filename -filesize -createdate -iso -overwrite "E:\...\Test from\pic 002.JPG" > "E:\...\Test to\out.txt". This works if I paste this string to the C:\> in the cmd.exe window.
This command reads the pic 002.jpg and writes the out.txt to another folder, overwrites existing file.

The closet I have got is:
C:\...\Exif-Tool\exiftool -t -filename -filesize -createdate -iso -w txt "E:\...\Test from\pic 002.JPG"  > "E:\...\Test from\pic 002.txt". This works from Excel, creates the *.txt file in the same folder as pic.jpg file!

If I copy and paste following string to the C:\>, I can move the pic.txt > out.txt in another folder.
move /Y "E:\...\Test from\pic 002.txt"  "E:\...\Test to\out.txt"

I try to use ExifTool as Windows Explorer do not show some/many importent camera settings as for me now ISO. I then let a macro read the created out.txt file and present the data together with the Picture in a User Form.
The problem is that I can't automize this yet - is it possible? Can it be done in another way?

Thanks in advance

Phil Harvey

Try this in Excel:

C:\...\Exif-Tool\exiftool -t -filename -filesize -createdate -iso -w "E:\...\Test to\%f.txt" "E:\...\Test from\pic 002.JPG"

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Olof

Thanks Phil,
this was one step forward, but a new output file with the JPEG's file name (*.txt extension) was created. In a different folder though - thats good.
Can the output always be the same filene name, so I don't have to delete it (want the new to overwrite the one in the folder). In this case I look at one JPEG at the time.

Can this be done?

Olof

Phil Harvey

Hi Olof,

If you want a constant output file name, you can use this trick: -w %0fNAME.txt

This is all explained in the -w option documentation.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Olof

Thanks Phil for your comment,
I now have some sudying to do.
Didn't find that section of the documention by myself.

Olof

Olof

Hi Phil,

After some testing I found two ways that seems to be equal:
1. ...\Meta%0.0f.txt ...
C:\...\Exif-Tool\exiftool -t -filename -iso -w! "E:\...\MetaData\Meta%0.0f.txt" "E:\...\Pictures\pic 011.JPG   

2. ...\%0fMeta.txt ...
C:\...\Exif-Tool\exiftool -t -filename -iso -w! "E:\...\MetaData\%0fMeta.txt" "E:\...\Pictures\pic 011.JPG   

Both reads the meta-data and writes it to Meta.txt file, overwrites if there is an existing file.
This was exactly what I wanted!

Next step for me, will be to write to *.jpg files from Excel.

Thanks for your help to point out the direction I should go.

Olof