Jump to content

Copy Files From Portable Device to PC Folder


Recommended Posts

We have a PC here at work that we'd like to dedicate to pulling information off handheld devices when the device is connected. I found a piece of code that registers when a device is connected, which is good but I'm not sure with what I wrote is accessing the Portable Device to move the files since nothing is getting copied over. 

; ---- Copy files Portable Devices to C Drive ----
            Local $Portable_Device = "\Computer\MobileMapper PocketPC\Storage Card\AutoCAD"
            If FileExists($Portable_Device) Then
                Local $FileDir = "C:\test\FILE_"
                $dir = DirCreate($FileDir & @MON & @MDAY & @YEAR)
                FileCopy($Portable_Device,$dir)
                ConsoleWrite("Done")
            EndIf

 

#include <WindowsConstants.au3>
#include <Date.au3>

$Form1_1 = GUICreate("")
GUIRegisterMsg($WM_DEVICECHANGE, "WM_DEVICECHANGE")
GUISetState(@SW_SHOW)
Do
Until GUIGetMsg() = -3

Func WM_DEVICECHANGE($hWnd, $msg, $wParam, $lParam)
    #forceref $hWnd, $msg, $wParam, $lParam
    Local $DBT_DEVNODES_CHANGED = 0x00000007
    Switch $wParam
        Case $DBT_DEVNODES_CHANGED
            ConsoleWrite("+wParam: " & $wParam & @CRLF & "+lParam: " & $lParam & @CRLF & @CRLF)

            ; ---- Copy files Portable Devices to C Drive ----
            Local $Portable_Device = "\Computer\MobileMapper PocketPC\Storage Card\AutoCAD"
            If FileExists($Portable_Device) Then
                Local $FileDir = "C:\test\FILE_"
                $dir = DirCreate($FileDir & @MON & @MDAY & @YEAR)
                FileCopy($Portable_Device,$dir)
                ConsoleWrite("Done")
            EndIf

    EndSwitch
    Return 'GUI_RUNDEFMSG'
EndFunc   ;==>WM_DEVICECHANGE

; https://www.autoitscript.com/forum/topic/143297-how-to-activate-a-program-when-a-specific-usb-device-is-connected/

 

Device.png

Final Destination.png

Edited by aa2zz6
Link to comment
Share on other sites

Hello. You need to Implement Windows Portable Devices API. 

Probably You could find a commandline tool to handle this due API implementation above require a little Advanced knowledge.

Good look.

 

Saludos

Edited by Danyfirex
I wrote knowlegue lol
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...