Jump to content

Accessing phone storage (advice needed)


Recommended Posts

Hello all,

First, I wish you a happy new year.

I am building with autoit a substitution tool to sync my iTunes playlist with my android phone.

I have managed reading the itunes lib, but now I am stuck at reading / writing on my android device.

From all the searches I made, it is using MTP protocol. 

The Windows Explorer can read and write on the device.

The device appears as a "portable device".

 

Does anyone of you can direct me in some direction to keep investigate.

 

Thanks in advance

 

Gilles

Edited by gillesg
Link to comment
Share on other sites

Hello. If you want to do it using Windows API you need to implement WPD.

Saludos 

Link to comment
Share on other sites

4 hours ago, Danyfirex said:

Hello. If you want to do it using Windows API you need to implement WPD.

Saludos 

Hello,

Thanks for the pointer. I start trying, but not being famiiar with objcreateinterface syntax makes it very difficult.

I found your previous post. Have you been further down the road on implementing some WPD functions ?

 

It seems promising, but complex. Any help or advices will be appreciated

 

Gilles

 

 

Link to comment
Share on other sites

It's a little complex. I think the better alternative for you is use adb commandline tool.

 

But if you want to implement it using Raw AutoIt code. You would need maybe check MSDN's C++ examples and convert them to AutoIt. I really have not time to do it.

 

Saludos

Link to comment
Share on other sites

Thank for the info. I will try on my own.

All I need is 3 basic functions :
   1 - to be able to list the content of a device starting at a particular point
   2 - to be able to copy a file fom the PC to the device
   3 - to be able to delete form the device

I understood the DeviceManager script. But I am still stuck at getting the device.content. I have practice C++ long ago, and MS examples are still complex.

Regards

Link to comment
Share on other sites

  • 3 weeks later...

Hello,

After a little research on the side of the MTP protocol support, I realized that the windows explorer was accessing the device supporting MTP.
So I decided to use the Shell.Application COM object.

I propose you this little tool whose objective is to allow you to synchronize your iTunes playlists with an android phone.

I used teh work for the previous iTunes UDF published

I wrote a not complete version of file.au3 UDF mainly for _FileListToArrayRec, _PathSplit, FileExists, FileDelete, FileCopy, DirCreate, DirRemove, FileFindFirstFile, FileFindNextFile, 


I still have 2 points of potential improvement.
I did not find how to create a directory on an MTP device. I get around by copying an existing directory and using it as a template.
And yes, the creation does not work, but the copy yes.
On deletion, I can not avoid the delete confirmation request. The MTP device is not sensitive to the setting of the noconfirmdelete parameter ($SSF_NOCONFIRMRECYCLE)

I will now take care of the special elements: audio books, podcast, courses (iTunesU).

If you have ideas to solve my 2 improvement points, I'm interested.

 

Hope the apps will help some of you

 

Gilles

GUI - itunes Sync.7z

Link to comment
Share on other sites

  • 5 years later...

DLL

Local $ErrorOutput = DllStructCreate("wchar[128]")
Local $Output = DllStructCreate("wchar[1024]")
Local $DeviceName
; Local Dim $aResult[5]

Local $hDLL = DllOpen("PB.Ex_MTP_x64.dll")
; Local $hDLL = DllOpen("PB.Ex_MTP_x86.dll")
If @error Then
    MsgBox(0, "", "@error")
EndIf
DllCall($hDLL, "int", "ExamineMTP", "ptr", DllStructGetPtr($ErrorOutput))
If @error Then
    MsgBox(0, "ExamineMTP", "@error")
EndIf

; While 1
    $aResult = DllCall($hDLL, "int", "NextMTPEntry", "ptr", DllStructGetPtr($ErrorOutput))
    If @error Then
        MsgBox(0, "NextMTPEntry", "@error")
    EndIf
    ; If $aResult[0] Then
        DllCall($hDLL, "int", "MTPEntryName", "ptr", DllStructGetPtr($Output), "ptr", DllStructGetPtr($ErrorOutput))
        $DeviceName = DllStructGetData($Output, 1)
        MsgBox(0, "", $DeviceName)
    ; EndIf
; Wend

DllCall($hDLL, "int", "OpenMTP", "int", "1", "WSTR", $DeviceName, "ptr", DllStructGetPtr($ErrorOutput))
If @error Then
    MsgBox(0, "OpenMTP", "@error")
EndIf

DllCall($hDLL, "int", "GetMTPManufacturer", "int", "1", "ptr", DllStructGetPtr($Output), "ptr", DllStructGetPtr($ErrorOutput))
If @error Then
    MsgBox(0, "GetMTPManufacturer", "@error")
EndIf

MsgBox(0, "GetMTPManufacturer", DllStructGetData($Output, 1))
DllCall($hDLL, "int", "CloseMTP", "int", "1", "ptr", DllStructGetPtr($ErrorOutput))

DllClose($hDLL)

$ErrorOutput = 0
$Output = 0

There are examples in PureBasic, but I'm too lazy to redo it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...