Executing ExifTool by VB-Script in Expression Media2

Started by snahl, May 17, 2010, 07:11:49 PM

Previous topic - Next topic

snahl

Hello Phil,

I was trying to call 'exiftool.exe' from a VB-Script and was wondering how I could do that.

Background:
To better manage my thousands of photos I use Expression Media 2 from Microsoft (EM2). So far this tool has served me very well.
It's simple, intuitive and allows me to write own scripts - a great feature I'm using quite often.
EM2 offers a drag and drop interface to add geodetic information for one or for a selection of images.
Unfortunately the Lat/Long values remain in the database only and is NOT written into the annotation-fields for longitude and latitude nor into the EXIF fields of an image. I am not unhappy that EM2 is not writing into the EXIF header as I prefer using your ExifTool for such tasks.

The goal is to make use of a VB-Script that reads the annotated geodetic information out of the database and uses 'Exiftool' to write that information into EXIF section of an image file.
To be more specific: not simply -gps:all, only Latitude and Longitude as these are the only 2 values available.

Meanwhile I have written that script and hope you will take a look at it so that I am running less a risk of doing harm to my images.

Initially the problem was that I didn't know how to call 'Exiftool' from within a VB-script and then have it execute according to the selection and the paramters provided. Just like as if I would enter the command and it's parameters from the command-line.
But instead of using a File-List.txt I want to apply the commands onto the selected images within EM2.
It seems as if I've got this to work quite allright. Eventhough ExifTool is executed for each selected item whereas working with a filelist would be more efficient and elegent.
But with this script I can easily geotag images from within the EM2 and have that data written into EXIF where it belongs to.
Currently the script spits out exactly the command-line below:

%comspec% /k exiftool -gps:GPSLongitude="W 107° 58' 33.14"" -gps:GPSLatitude="N 038° 12' 51.08"" "D:\IMAGES\2009\US\09-30 Ridgway County Rd7\NK028466.NEF" -v2

Hope you will find something and give me some hints and advice on how to improve this script that is available here on my WEB-Site:
http://www.halo-photographs.com/scripts/exiftool-script-for-expression-media.html

I am not quite sure wether I need to transform the values for Lat/Long.
currently they come out of the database exactly as follows:
- iptclong = W 107° 58' 33.14"
- iptclat = N 038° 12' 51.08"

Also I am not quite sure about the '-overwrite_original'. Will this change the original file creation date (like on a MAC) as described in the AppDocu.?

According to the FAQ those values should be transformed, but before I went through the tediuos process of transforming weird strings, I simply gave it a shot and it worked allright.
Probably because you anticipated such issues and made ExifTool take care of it, many thanks.

Thank you for your attention and consideration.
Looking forward to your reply.
Best regards, Hans.

PS:
I went reading the articles relating to VB at your WEB-Site, but honestly this was too much for me. I'd probably be doing more damage than anything else.
https://exiftool.org/forum/index.php/topic,1401.0.html

Then reading an archived Blog from 'Hey, scripting guy', I found exactly what I needed to get going:
http://blogs.technet.com/heyscriptingguy/archive/2005/11/11/how-can-i-get-the-command-window-to-stay-open-after-running-a-command-line-tool.aspx
Dig-IT-all

Phil Harvey

...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 ($).

snahl

Hi Phil,

yes, I did check the Programming Section.
...and I did make the VB-script run allright (for that reason I used the past tense in my first sentence).
I just wanted to provide some background so other readers may follow as well.

To make a long story shorter, maybe it's better to start reading my post from here:

QuoteHope you will find something and give me some hints and advice on how to improve this script that is available here on my WEB-Site:

The 2 important questions are about transforming lat/long values and avoiding the change of the filecreation date.
Equally important, I'm seeking your feedback about the script and the way it's handling the command exiftool.

Thanks, Hans.
Dig-IT-all

Phil Harvey

ExifTool will accept the coordinate format you are writing, but you also need to write the GPSLatitude/LongitudeRef tags, which accept only values of N, S, E and W.

The file modification date will be changed unless you use the -P option.  The -overwrite_original option does not affect this.

- 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 ($).