WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: mueer01 on July 03, 2015, 05:42:55 AM

Title: Set "Date Taken" in .jpg files
Post by: mueer01 on July 03, 2015, 05:42:55 AM
Hello,

I scanned old photos, and now I want to set the "Date taken" attribute in the .jpg files.
Already installed DSOFILE component and run the example for .doc files, found here in the forum. But unfortunately this does not work for .jpg files.

Does anyone have an example to set the "Date taken" attribute?

Regards,
Erhard
Title: Re: Set "Date Taken" in .jpg files
Post by: td on July 03, 2015, 07:24:32 AM
Please see the following in the the Tech Database:

http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WIL~Extenders/_Third~Party~Extenders/Property~Store~Utility+Property~Store~Extender.txt (http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WIL~Extenders/_Third~Party~Extenders/Property~Store~Utility+Property~Store~Extender.txt)
Title: Re: Set "Date Taken" in .jpg files
Post by: mueer01 on July 05, 2015, 11:17:33 PM
EXACTLY what I was looking for!
Many Thanks.
Title: Re: Set "Date Taken" in .jpg files
Post by: mueer01 on July 06, 2015, 12:00:13 AM
Hi td,

one more question/problem. I tried these simple script:

---
AddExtender("WWPSU45Ix86.dll")
PSIndex = psuOpenPS("C:\tmp\pic1.jpg", 0)

DateTaken = psuGetPropertyValue(PSIndex, "System.Photo.DateTaken", 0)
message("DateTaken", DateTaken)

ret = psuSetPropertyValue(PSIndex, "System.Photo.DateTaken", "01.02.1993 15:00")
message("ret", ret)

psuClosePS(PSIndex)
---

The function psuGetPropertyValue() works fine. The date is returned.
But function psuSetPropertyValue() returns an ERROR popup with "...Access denied due to insufficient rights."

The file has "Full Control to Everyone", and I can modify DateTaken manually in the File Properties, of course.
I also tried it with different pics in different folders.

Regards,
Erhard


   

Title: Re: Set "Date Taken" in .jpg files
Post by: td on July 06, 2015, 08:31:38 AM
Perhaps review the extenders documentation and try the correct gps-flags parameter value.  The psuOpenPS function's documentation states:

"(i) gps-flags:  [Get Property Store Flags]  One or more optional flag bits in a mask value that controls how the property store is opened for the file.  A value of 0 [zero] opens in read-only mode.  A value of 2 [two] opens in read-write mode."

and the extender's associated Tech Support article states:

"Call psuSetPropertyValue() to modify the value of a writeable property in the property store. This function always fails if the open-mode is read-only, and also fails if the property itself is read-only even when the open mode is read-write."

If that doesn't help then the extender's author may have additional advice.