ExifTool Forum

ExifTool => Newbies => Topic started by: Sylvain M. on October 12, 2014, 04:06:21 AM

Title: Batch Script to assign values
Post by: Sylvain M. on October 12, 2014, 04:06:21 AM
Hello everyone,
Excuse me if the question has been asked before: I'm French and it's hard for me to read every issue.
I wish to write a script that exiftool do the following:
- Ask two variables "Longitude" & "Latitude" that the user must enter (1)
- Assign these 2 variables to the corresponding EXIF fields identified pictures of a folder (and its subfolders, maybe optional) (2)

For the (1), it's might be something like this :
echo off
cls
set /p LATITUDE= Latitude :
set /p LONGITUDE= Longitude :
cls
echo Assign LAT %LATITUDE% and LONG %LONGITUDE% to folder %1


(%1 because i would like to assign the folder by dragging on the script)

And for (2), something like this :
exiftool xmp:gpslatitude=%LATITUDE% -xmp:gpslongitude=%LONGITUDE% ...

but for now, I can not write things correctly.
But I started completely scripting!

Does someone could help me ?

Thanks a lot.

Sylvain M.
Title: Re: Batch Script to assign values
Post by: Phil Harvey on October 12, 2014, 06:08:47 AM
Hi Sylvain,

Your exiftool command looks good, except that you missed a leading "-", and you need to add the folder name:

exiftool -xmp:gpslatitude=%LATITUDE% -xmp:gpslongitude=%LONGITUDE% %1

- Phil
Title: Re: Batch Script to assign values
Post by: Sylvain M. on October 12, 2014, 06:35:44 AM
It Works: great!
The script keeps the original copy of the images.
Can you tell me the procedure for not keeping it (even if it's dangerous, I admit).
Thank you so much!

Sylvain M.

[edit]
Excuse me, but I realize that the subfolders are not updated.
Can you also remember the procedure to update subfolders ? (if possible, to put an option in the settings required by the script)
[/edit]

echo off
cls
set /p LATITUDE= Latitude :
set /p LONGITUDE= Longitude :
cls
echo Assign LAT %LATITUDE% and LONG %LONGITUDE% to folder %1
exiftool -xmp:gpslatitude=%LATITUDE% -xmp:gpslongitude=%LONGITUDE% %1
rem arrĂȘt
pause
Title: Re: Batch Script to assign values
Post by: Phil Harvey on October 12, 2014, 08:35:48 AM
Quote from: Sylvain M. on October 12, 2014, 06:35:44 AM
Can you tell me the procedure for not keeping it (even if it's dangerous, I admit).

Add -overwrite_original to the command.

QuoteCan you also remember the procedure to update subfolders ?

Add -r

- Phil
Title: Re: Batch Script to assign values
Post by: Sylvain M. on October 12, 2014, 01:44:51 PM
thank you very much: it's perfect!