' ------------------------------------------------------------------------------------ ' GetCreationDate.vbs ' MyAlbum is normally using the "last modified date" of the pictures but some users ' may want to have access to the "creation date" of the files. ' This script will retrieve the creation date & time of the picture and store it in ' two Custom Fields. ' Add to the album two custom fields: ' - CreationDate of type Date ' - CreationTime of type Time ' ------------------------------------------------------------------------------------ Option Explicit const sCustomFieldDate = "CreationDate" const sCustomFieldTime = "CreationTime" app.ClearTrace Dim fso, file, alb, pic, n, i, date Set fso = CreateObject("Scripting.FileSystemObject") set alb = app.GetCurrentAlbum n = alb.nbPicture for i = 0 to n-1 set pic = alb.GetPicture( i ) date = pic.GetCustomFieldDate( sCustomFieldDate ) if date = 0 then ' Field is not defined for this picture Set file = fso.GetFile( alb.ExpandMacro( pic ,"%RP" )) app.Trace pic.sFileName & vbTab & file.DateCreated pic.setCustomFieldDate sCustomField, app.DateToTimeValue( file.DateCreated ) date = app.DateToTimeValue( file.DateCreated ) mod (3600*24) pic.setCustomFieldDate sCustomFieldTime, date end if next alb.Redraw app.Trace "Done !"