Page 1 of 6

path to iPhone DCIM Directory

Posted: Wed Mar 25, 2020 11:19 pm
by AUGE_OHR
hi,

when connect my iPhone to Windows 10 via USB i go a new Device "Apple iPhone"
i can open Folder with Explorer and get to "This PC\Apple iPhone\Internal Storage\DCIM"

Question : how get to that Folder with harbour / HMG :idea:

iPhone is not shown as Storage only as
Apple Mobile Device USB Composite Device

Re: path to iPhone DCIM Directory

Posted: Sat Mar 28, 2020 6:21 pm
by danielmaximiliano

Re: path to iPhone DCIM Directory

Posted: Sat Mar 28, 2020 11:37 pm
by AUGE_OHR
hi
thx for Link, i will study it

Re: path to iPhone DCIM Directory

Posted: Sun Mar 29, 2020 7:16 am
by AUGE_OHR
hi,

i have work on link
https://stackoverflow.com/questions/110 ... n-windows
and i got "full-path" and file-Name

Code: Select all

   cItem := "APPLE IPHONE"
   oShell := CreateObject( "shell.application" )
   IF NIL <> oShell
      oFolder := oShell:NameSpace(CSIDL_DRIVES ) // 0x0011 // My Computer
      IF NIL <> oFolder
         oItems := oFolder:Items()
         iMax := oItems:Count
         FOR i := 1 TO iMax
            oItem := oItems:Item( i - 1 )
            IF !EMPTY( oItem )
               cName := UPPER( oItem:name )
               IF cName = cItem                  // "APPLE IPHONE"
                  cPath := oItem:path            // GUID ?
next was Sub-Folder to get to folder with Image

Code: Select all

 oFolderItem := oItem:GetFolder:items  // "APPLE IPHONE"
  objFolder := oThis:GetFolder:Items   // "Internal Storage"
   oItemL := oItemF:GetFolder:Items    // "DCIM"
    oItemN := oItemM:GetFolder:Items   // "103APPLE"
    nMax := oItemN:Count
    FOR n := 1 TO nMax
      oFile := oItemN:Item( n - 1 )
      cThis := oFile:name
      cSrcP := oFile:Path
      AADD(aFiles,{cThis,cPath,cSrcP})
    NEXT
now i have try to use CopyFile API ...
https://docs.microsoft.com/en-us/previo ... dfrom=MSDN

Code: Select all

   IF !EMPTY(aFiles)
      fso := CreateObject("Scripting.FileSystemObject")
      iMax := LEN(aFiles)
      FOR i := 1 TO iMax
         cFile := aFiles[i][3]
         cFile += "\"
         cFile += aFiles[i][1]
         fso:CopyFile(cFile,cTarget)
      NEXT
      fso := NIL
   ENDIF
but something is going wrong
CopyFile.jpg
CopyFile.jpg (73.7 KiB) Viewed 2648 times
i "think" something in "Path" (cSrcP) is wrong ... or is it my Syntax :idea:
IPHONE01.ZIP
(1.01 KiB) Downloaded 125 times

Re: path to iPhone DCIM Directory

Posted: Sun Mar 29, 2020 12:50 pm
by danielmaximiliano
Hi Jimmy:
I do not have Ihpone, I have Motorola G8 plus that also delivers a Virtual unit like MotoG8 inside the unit: Internal storage and SD card, I see that it is well on track with its source code, my point of view is how to work with FileCopy in virtual drives since I did not fully read the link I sent you or the Harbor code, nor did I know how to find out the virtual drives on your PC.

Hola Jimmy : no tengo Ihpone, tengo Motorola G8 plus que tambien entrega una unidad Virtual como MotoG8 dentro la unidad: Almacenamiento interno y SD card, veo que va bien encaminado con su codigo fuente, mi punto de vista es como trabajar con FileCopy en las unidades virtuales ya que no lei completamente el enlace que le envie ni el codigo Harbour, tampoco se como hizo para averiguar las unidades virtuales en su PC.

Re: path to iPhone DCIM Directory

Posted: Sun Mar 29, 2020 3:20 pm
by danielmaximiliano
AUGE_OHR wrote: Sun Mar 29, 2020 7:16 am hi

now i have try to use CopyFile API ...
https://docs.microsoft.com/en-us/previo ... dfrom=MSDN

Code: Select all

   IF !EMPTY(aFiles)
      fso := CreateObject("Scripting.FileSystemObject")
      iMax := LEN(aFiles)
      FOR i := 1 TO iMax
         cFile := aFiles[i][3]
         cFile += "\"
         cFile += aFiles[i][1]
         fso:CopyFile(cFile,cTarget)
      NEXT
      fso := NIL
   ENDIF
but something is going wrong
CopyFile.jpg
i "think" something in "Path" (cSrcP) is wrong ... or is it my Syntax :idea:
IPHONE01.ZIP
https://docs.microsoft.com/en-us/window ... e-copyfile

Re: path to iPhone DCIM Directory

Posted: Sun Mar 29, 2020 10:17 pm
by AUGE_OHR
hi,

it seems more complicate

Code: Select all

   fsMyStream = System.IO.File.Open(taregetFullFileName, IO.FileMode.Open, IO.FileAccess.ReadWrite)
   fsMyStream.Close()
i have to create a Stream to "Copy" ... :roll:

Re: path to iPhone DCIM Directory

Posted: Mon Mar 30, 2020 2:19 am
by AUGE_OHR
hi,

go it :D
after get "Folder" 103APPLE i use this to copy hole Folder

Code: Select all

PROCEDURE DoCopyHere(oAppleFile, cTarget )
LOCAL obj := CreateObject( "Shell.Application" )
LOCAL oFolder := obj:NameSpace(  cTarget )
   oFolder:CopyHere(oAppleFile)
RETURN
---

i guess it work also for "other" Device when display under "My Computer"
will make a full Demo ...

Re: path to iPhone DCIM Directory

Posted: Mon Mar 30, 2020 5:10 am
by AUGE_OHR
hi,

have try next Step to select wanted Images
HMG_GetIPhoneImage.jpg
HMG_GetIPhoneImage.jpg (150.85 KiB) Viewed 2567 times
but i have to figure out how to "transfer" with COPYHERE()
https://docs.microsoft.com/en-us/window ... r-copyhere

p.s. Size 0 and funny Date ... hm

Re: path to iPhone DCIM Directory

Posted: Mon Mar 30, 2020 4:10 pm
by AUGE_OHR
hi,

i "remember" that i have use COPYHERE before ... to ZIP Files :D

Problem was : COPYHERE work Asynchrone so it need a "Trick"

Code: Select all

PROCEDURE DoCopySingle( oDirFolder, cTarget )
LOCAL obj     := CreateObject( "Shell.Application" )
LOCAL oTarget := obj:NameSpace( cTarget )
LOCAL xFlag   := FOF_SIMPLEPROGRESS
LOCAL aFiles  := {}
LOCAL oFile, cFile, xCount, nCount, i, iMax, nSkip := 0

   iMax := oDirFolder:Count
   FOR i := 1 TO iMax
      // if Checkbox is marked
      IF IPHONE.Grid_1.CheckBoxItem( i ) = .T.
         // get Item Object
         oFile := oDirFolder:Item( i - 1 )
         // copy / stram single Object file
         oTarget:CopyHere( oFile, xFlag )
         // wait until all files are written
         xCount := 0
         DO WHILE .T.
            // compare if file is written
            nCount := oTarget:items() :Count()
            IF nCount + nSkip >= i
               EXIT
            ENDIF
            SLEEP( 10 )
            xCount ++
            IF xCount > 50
               EXIT
            ENDIF
         ENDDO
      ELSE
         // Skip un-marked
         nSkip ++
      ENDIF
      IPHONE.ProgressBar_1.Value := CalcPos(i, iMax )
   NEXT
   // clean up
   IPHONE.ProgressBar_1.Value := 0
   oTarget := NIL
   obj := NIL
RETURN