Page 1 of 1
read the xmp CreatedDate add 2 years to it and write the result into another custom xmp
Posted: Mon Jan 13, 2014 11:28 am
by McCannManchester
Hi hope someone can help with this problem
Take an incoming image read the xmp:CreateDate add 2 years to the CreatedDate write the result to a custom xmp field.
Ok i've already created a work flow that reads/writes to custom xmp fields, this problem i think needs a script, as just writing a static value is straight forward but the value need to be calculated.
Why you ask well we are looking to add and expiry date.
read the xmp CreatedDate add 2 years to it and write the result into another custom xmp
Posted: Mon Jan 13, 2014 4:58 pm
by dkelly
var theCreateDate = new Date();
var theXmp = job.getDataset("Xmp");
if (theXmp != null) {
theCreateDate = theXmp.getDate( "xmp:CreateDate" , null );
theCreateDate.setYear(theCreateDate.getYear()+2);
}
theCreateDate.toString();
read the xmp CreatedDate add 2 years to it and write the result into another custom xmp
Posted: Thu Jan 16, 2014 5:47 pm
by McCannManchester
hi and thanks for the script, as you can see below it has embedded a date into the wxmv:valid_to_date only its the time and date of when it went through the workflow?
just to check i've done thinks right, using the 'XMP inject' tool i've chosen the area to which i want the value writing to in the 'XMP location path' in the 'New value' area i've chosen to 'Define script expression' and pasted the script.
As you can see the 'CreateDate' of the image is 2013-12-18T16:48:51.
Any ideas
Thanks
read the xmp CreatedDate add 2 years to it and write the result into another custom xmp
Posted: Thu Jan 16, 2014 7:30 pm
by dkelly
It appears that the script did not find any XMP metadata for the job. Does your flow have a "XMP pickup" element to read the job's embedded XMP metadata in to a Switch dataset?
read the xmp CreatedDate add 2 years to it and write the result into another custom xmp
Posted: Fri Jan 31, 2014 11:25 am
by McCannManchester
Thanks for your help i hadn't quite got the workflow right it now works like a dream, thanks again