' ------------------------------------------------------------------------------------ ' Fix_CFDateTime.vbs ' This script was used to fix incorrect date & times stored in an album. ' ------------------------------------------------------------------------------------ option explicit const sCF1 = "Date" const sCF2 = "Time" dim alb, pic, i, n, s, sDate set alb = app.GetCurrentAlbum App.ClearTrace app.Trace "Album '" & alb.Name & "'" & vbTab & "v" & alb.ExpandMacro( Nothing, "%AV" ) app.Trace "Date format=" & alb.sDateFormat & vbTab & "Time format=" & alb.sTimeFormat n = alb.nbPicture for i = 0 to n-1 set pic = alb.GetPicture(i) s = pic.GetCustomField(sCF1) if s <> "" and pic.GetCustomFieldDate(sCF1) = 0 then sDate = CDate(s) App.Trace "Incorrect date: " & s pic.SetCustomFieldDate sCF1, app.DateToTimeValue( sDate ) end if s = pic.GetCustomField(sCF2) if s <> "" and pic.GetCustomFieldDate(sCF2) = 0 then sDate = CDate(s) App.Trace "Incorrect time: " & s pic.SetCustomFieldDate sCF2, app.DateToTimeValue( sDate ) end if 'app.trace pic.GetCustomField(sCF1) 'app.trace pic.GetCustomFieldDate(sCF1) 'app.trace pic.GetCustomField(sCF2) 'app.trace pic.GetCustomFieldDate(sCF2) next