Jump to content

How to properly identify source location from connected Android phone - (Moved)


Go to solution Solved by Nine,

Recommended Posts

Posted

Environment: Windows 10 laptop with connected Android phone (Android 11)

I am trying to copy some .wav files from my connected Android phone:

filecopy("This PC\Galaxy A42 5G\Phone\Android\data\com.Chillseekers.MiracleBox\files\*.wav", "C:\Users\BLAH\Documents\The Miracle Box\",$FC_OVERWRITE)

but the source location is not recognized.

How do I properly identify the source?

Please note: I have already tried changing the save location of .wav files to sd card, but that functionality does not work in the app that creates the .wav files.

  • Developers
Posted

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • Solution
Posted

You cannot use this approach to copy files from Android to you PC.  As well described :

https://superuser.com/questions/1281989/not-able-to-access-path-of-mobile-phone-in-cmd

https://android.stackexchange.com/questions/57429/open-command-prompt-to-access-folders-of-a-usb-connected-android-phone

However you can use a Shell.Application object to perform such a task.  Here my code to copy all *.jpg from phone to computer.  (Note that copyHere has multiple flags that you can set.  Search MSDN for a list.)

#include <Constants.au3>
#include <File.au3>

Opt("MustDeclareVars", 1)

Local $oShellApplication = ObjCreate("Shell.Application")
Local $oShellFolder = $oShellApplication.NameSpace(17) ; drives
Local $oShellFolderItems = $oShellFolder.Items()
For $oFolder in $oShellFolderItems
  ConsoleWrite ($oFolder.name & @CRLF)
  If $oFolder.name = "Moto G Play" Then ExitLoop
Next

Local $oRoot = $oFolder.GetFolder
Local $oRootItems = $oRoot.Items()
For $oSource in $oRootItems
  ConsoleWrite ($oSource.name & @CRLF)
  If $oSource.name = "Carte SD" Then ExitLoop
Next
$oRoot = $oSource.GetFolder
$oRootItems = $oRoot.Items()
For $oSource in $oRootItems
  ConsoleWrite ($oSource.name & @CRLF)
  If $oSource.name = "DCIM" Then ExitLoop
Next
$oRoot = $oSource.GetFolder
$oRootItems = $oRoot.Items()
For $oSource in $oRootItems
  ConsoleWrite ($oSource.name & @CRLF)
  If $oSource.name = "Camera" Then ExitLoop
Next
$oRoot = $oSource.GetFolder
$oRootItems = $oRoot.Items()

Local $sDrive, $sDir, $sFileName, $sExtension
Local $oDestination = $oShellApplication.NameSpace("C:\Apps\Temp")
For $oSource in $oRootItems
  _PathSplit($oSource.name, $sDrive, $sDir, $sFileName, $sExtension)
  If $sExtension = ".jpg" Then
    $oDestination.CopyHere($oSource)
    ConsoleWrite ("Copied " & $oSource.name & "/" & $oRoot.GetDetailsOf ($oSource,2) & @CRLF)
  EndIf
Next

 

Posted (edited)

Just replace the name of the various components to yours.

For example "Mota G Play"  is the name of my phone.  Replace with yours : "Galaxy A42 5G".  Follow the path of the directory tree of yours. 

Edited by Nine
Posted

Ok, thanks for the clarification about the device name. However, I do not need to recurse through the entire file system for every .wav file. I only need to copy *.wav from one folder.

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
×
×
  • Create New...