• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 418
  • Last Modified:

WIA to find photos on camera/iPad and copy- issue with code

I have successfully used the code below to find photos on my iPad that are between a dat range.

However, when the photos are copied to a folder onmy hard drive, they end up with the date and time that they were copied, not when they were taken or 'created'.

I've viewed both the 'Modified' and 'Created' dates and both are the copied date and time.

If I access the iPad directly and then highlight/copy these same photos, the modified/created date/time are the correct

HELP!
'loop trough all (root) items in the camera device
    For Each itm In d.Items
    Dim f As Properties
    
    Set f = itm.Properties
    Dim str As String
        
    lCounter = lCounter + 1
        
        DoEvents
            
           
            strHold = ""
                    
            Name = d.Items(lCounter).Properties("Item Name").Value
            Ext = d.Items(lCounter).Properties("Filename extension").Value
            Set v = d.Items(lCounter).Properties("Item Time Stamp").Value
            PhotoDate = Format(v.Date, "mm/dd/yyyy")
            'Debug.Print "Photo Number " & Format(i, "##0") & "  Name: " & Name & "." & Ext & "  Date taken: " & PhotoDate

           If IsBetween(PhotoDate, dtDateFrom, dtDateTo) Then
            
            
                'download the file to a temp buffer
                Set imgpic = itm.Transfer
                
                
                'store the file name and extension and app.path in a string,
                'so you can use it to perform more operations on it
                str = App.Path & "\downloaded images\" & Name & "." & Ext

              
                imgpic.SaveFile str
                
           End If
           
        Next

Open in new window

0
scbdpm
Asked:
scbdpm
  • 2
  • 2
1 Solution
 
scbdpmAuthor Commented:
bump
0
 
RimvisCommented:
0
 
scbdpmAuthor Commented:
not sure how this applies.....
0
 
RimvisCommented:
You need to change file time after you save your files to disk ("imgpic.SaveFile str")

1) Create variable with type SYSTEMTIME. Assign to value of v.Date
Dim dSysTime as SYSTEMTIME
dSysTime.wYear = Year(v.Date)
... and so on ...

2) Convert SYSTIME to FILETIME
Dim dFileTime as FILETIME
SystemTimeToFileTime(dSysTime, dFileTime)

3) Get a handle to your file
Dim hFile As Long
hFile = OpenFile(str, OFS, OF_READWRITE)

4) Change file time
SetFileTime(hFile, dFileTime, dFileTime, dFileTime)
0
 
mlmccCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now