Page 1 of 1
A specific timestamping scenario
Posted: 14 Oct 2016 15:12
by Theli
I have to change the modified date of hundreds of pictures.
These pictures have 2 (different) dates: the original date taken and the date when the file was last edited by PS CS3/CS5.
If I use
File Special - Set modified date to Exif, I only get the first date. But I have a specific need for the edited date, the second one.
I searched in the help and the forum but couldn't find a way to make XY pick this date to timestamping. Is it possible?
The thought of having to change the dates one by one is haunting me...

Re: A specific timestamping scenario
Posted: 14 Oct 2016 16:17
by highend
Do you have the pro version of XY?
If yes, select one of these pictures and execute this mini script from the address bar:
Code: Select all
text "DateTime: " . get("exif", 0x0132) . "<crlf>DateTimeOriginal: " . get("exif", 0x9003) . "<crlf>DateTimeDigitized: " . get("exif", 0x9004);
Is one of these three dates the one you're looking for? Maybe the first one?
Re: A specific timestamping scenario
Posted: 14 Oct 2016 16:40
by Theli
Thanks for the fast reply!
Yes, I use the pro version. And yes, the script gives me the date I need (indeed the first one).
But how to use it in a batch timestamping? Another script?
Re: A specific timestamping scenario
Posted: 14 Oct 2016 16:44
by highend
Exactly.
Select all files that need to be renamed, execute this script (e.g. from Menu - Scripting - Run Script...)
Code: Select all
foreach($file, <get SelectedItemsPathNames |>, "|") {
if (exists($file) != 1) { continue; }
$exifDate = get("exif", 0x0132, $file);
$date = gettoken($exifDate, 1);
timestamp "m", replace($exifDate, $date, replace($date, ":", ".")), $file;
}
Do this with a few test files first to make sure it does what you need!
Re: A specific timestamping scenario
Posted: 14 Oct 2016 17:11
by Theli
I did a copy of one folder with pictures to test it.
The script seems to work but ends with an error:
Invalid date: 2010.05.24 21:50:51
Probably because the date in my system is in the format 24/05/2010.
Any way to work around this?
Re: A specific timestamping scenario
Posted: 14 Oct 2016 17:27
by highend
<- Different time format here...
Try this:
Code: Select all
foreach($file, <get SelectedItemsPathNames |>, "|") {
if (exists($file) != 1) { continue; }
$exifDate = get("exif", 0x0132, $file);
$date = gettoken($exifDate, 1);
timestamp "m", replace($exifDate, $date, formatdate(replace($date, ":", "."))), $file;
}
Re: A specific timestamping scenario
Posted: 14 Oct 2016 17:39
by Theli
No. The error persists.
There's a way to use the script to just copy the time from the Exif tag? I can paste the date part manually if nothing else works.
Re: A specific timestamping scenario
Posted: 14 Oct 2016 18:02
by highend
Not necessary
Edit: Changed it to a more elegant version...
Code: Select all
$k = quote("HKEY_CURRENT_USER\Control Panel\International"); $v = quote("sDate");
$delim = formatlist(gettoken(runret("REG QUERY $k /v $v"), 4, " "), "e", <crlf>);
foreach($file, <get SelectedItemsPathNames |>, "|") {
if (exists($file) != 1) { continue; }
$exifDate = get("exif", 0x0132, $file);
$date = gettoken($exifDate, 1);
timestamp "m", replace($exifDate, $date, formatdate(replace($date, ":", $delim))), $file;
}
Re: A specific timestamping scenario
Posted: 14 Oct 2016 18:18
by Theli
Now it worked flawlessly!
WOW. All this script thing is still a big mystery to me...
Thanks so much for your time and all the help!
